General course chat

Hi Everyone, I have some black corners (because of transformation) in my training dataset images. Will this affect the prediction (Jeremy mentioned in 1st class to look out for any black borders or out of ordinary content in the image) if yes then how to handle this. Any help is appreciated. Thanks.

I would just go with your current data and see what is the accuracy. At least what I know it shouldn’t affect much if it is caused by rotation. I think Jeremy said that was because if all your images have huge black border before even transforming there could be something wrong with your implementation. And if there is some solution to get rid of those black boarder it could be nice to hear how much better it made the model.

Only easy way which I come up is to zoom in little bit so black isn’t showing anymore but I don’t think it will make any difference.

1 Like

Not sure why this happens, but it did happen to me this afternoon with another repo. For a temporary measure, you might want to use this webpage (http://nbviewer.jupyter.org/) to view .ipynb by coping URL into the specified field.

Hello! I don’t know do I writing to right topic.
I suppose that it is good to add class labels to that function:
fd = FileDeleter(file_paths=top_loss_paths).
Because as i mentioned due to hand data cleaning: some photos are from wrong classes.
For example, if asked for photos of angry person, there are also those photos which captions were: ‘not angry’ and so on. But my second class is happy persons, so I have some happy persons inside angry and can’t check this with FileDeleter.

1 Like

Please access it by cloning the repository and running jupyter notebook from your command line in the desired folder.

In this way, you can experiment with it as well (first create a copy).

1 Like

Please refer to the Lesson 2 thread

If you specified a test directory path when creating your ImageDataBunch you can call get_preds and specify is_test=True as in:

learn.get_preds(is_test=True)

4 Likes

Thanks, let me try that.

I added the test data to the data bunch using the data block API: .databunch(test=“test”).

Then I got predictions using: multi_label_classification_predictions,target_values = learn.TTA()

1 Like

Even better! Don’t forget to flag is_test=True in TTA.

1 Like

When I do: multi_label_classification_predictions,target_values = learn.TTA(is_test=True), it throws an error: TypeError: object of type ‘NoneType’ has no len()

Can you explain how you created your ImageDataBunch object?

Here’s my code
np.random.seed()
data = (ImageFileList.from_folder(path)
.label_from_csv(‘train.csv’, sep=’ ‘, folder=‘train’, suffix=’.jpg’)
.random_split_by_pct(0.2)
.datasets(ImageMultiDataset)
.transform(tfms, size=224)
.databunch(test=“test”)
.normalize(imagenet_stats))

1 Like

Try creating a DataBunch object by using:

ImageDataBunch.from_csv

I think it will help you do this much easier.

Remember to send the fn_col and label_col arguments to tell your object in which columns of the csv it can find filenames and labels, the label_delim argument to tell it how labels are delimited in your csv, and suffix to be able to find the images in the path.

Please let me know if you get stuck.

1 Like

Okay, I’ll try that. Thanks

1 Like

Can the “from_csv” dataloader have an optional column in the csv file to specify which files are in the training set and which are in the validation set? That would help when you have separate images derived from the same object (you would want to keep them as a group in either the training or validation group).

Not currently no. The .from_csv method currently only supports creating a random validation set.

This error comes when there is an outdated or no c++ complier on the system. The work around would be to either update visual studio or install the latest version of visual studio code on your computer. The first answer for the question may be helpful for your reference: https://stackoverflow.com/questions/48541801/microsoft-visual-c-14-0-is-required-get-it-with-microsoft-visual-c-build-t

How to use ReduceLROnPlateau Callback ? Do we pass on like metrics or call on learn ? It’s not mentioned in docs yet.

Actually it is now :wink:
@radek this is your baby, so feel free to document it better.

2 Likes

Does someone have a good way to preserve a notebook’s cell output? I really like Jeremy’s experimentation approach and do it a lot. I copy cells, change something, then run to compare to the previous output. I generally comment out the code in the old cell to avoid accidentally rerunning it. Here’s a simple example:

I find it very helpful to be able to compare several different runs. But sometimes I accidentally hit shift-enter in a commented cell and it erases the output.

I’m guessing somebody in the fastai community has figured out some clever way to preserve cell output until you no longer need it!

I have seen some approaches to saving nb state, large file outputs, etc., but this would be a way to just save cell output one at a time.

2 Likes