Any Ideas on how to modify Resnet with Images that have 2 channels?

In this file all transformations are defined in

here are the definition of basic transforms

transforms_basic    = [RandomRotateXY(10), RandomLightingXY(0.05, 0.05)]
transforms_side_on  = transforms_basic + [RandomFlipXY()]
transforms_top_down = transforms_basic + [RandomDihedralXY()]

You can easily make your own list of transforms with your own parameters.

Here is an example:

tfms = tfms_from_model(f_model, sz, aug_tfms=transforms_basic,
                       max_zoom=1.05)
5 Likes

Wow top 10! :smiley:

Two top 10 places left :slight_smile: - all need to do is to train inception_v4 with 4 epochs.

Hi @yinterian,

Deleting tmp directory magically made the predict(is_test=True) to run without errors, but I cannot quite figure out why. Could you explain it for us?

Thank you!

1 Like

@yinterian I am also unable to predict using your code, get error:

TypeError: ā€˜NoneTypeā€™ object is not iterable

After reading what worked for @hiromi have also deleted the folder in data/dogscats/temp and tried afterwards but no luck.

Apart of setting correct test name in ImageClassifierData.from_paths( ā€¦ test_name = ā€œcorrect_test_nameā€ )
and deleting temp folder after training, is there any obvious thing to do?

In my case the same error was caused by corrupted preprocessed validation/test set. Restarting notebook did not help. I changed image size a bit and create data object once again.

1 Like

The tmp file holds the precomputed activations. Most likely the first time you ran your code you didnā€™t use a test folder. Therefore you had precomputed activations for train and validations. The second time you ran it with a test folder but the library didnā€™t realized (there is a TODO) that it had to compute the test activations so it didnā€™t find the test activations gave you an error.

Does it make sense?

4 Likes

Hello,

Any idea where I can find good amount of satellite data which I can use to train a whole network then fine tune as in transfer learning for iceberg challenge.

Thanks :smiley:

This paper (https://arxiv.org/pdf/1704.02965.pdf) has suggestions for aerial imagery benchmark datasets. They also suggest generating datasets from the Google Maps API.

My approach for this competition might include using a Generative Adversarial Network to generate more training data.

1 Like

It does make sense. Thank you so much for clarifying! :slight_smile:

Yes, the kaggle Planet Amazon comp is a great source of data. Weā€™ll look at it today. Although itā€™s rainforest, not ocean!

1 Like

@sermakarevich Great work! Iā€™m also working on this comp and my accuracy levels looks good on train/valid sets but when I run the predictions with test_preds = learn.predict(is_test=True) the values I get are all negative. My original assumption was that the value closest to 0 (i.e. np.argmax) was the the one with the highest probability. But, for softmax Iā€™m used to the values being probabilities between 0 and 1 (with probs for all possible classes adding up to 1) and I think that is the format that Kaggle is looking for so just wondering how did you get the probabilities?

@jamesrequa those are logg ods, so first you need to do is
df = pd.DataFrame(np.exp(preds))

3 Likes

And always check data.classes before submitting, itā€™s ordering alphabetically I assume using sorted function. So, iceberg will be 0 and ships will be 1. Another thing to keep on mind. Hope this also helps.

@sermakarevich I also started working on dog breed competition but I am unable to get lesser than 0.55 loss on validation set(~2000 images). As of now, I have only tried resnet34. But it seems that validation loss has saturated and stopped reducing beyond 0.55. I started with learning rate of 0.1 based on lr_find and gradually moved to cyclical rate with data augmentation and unfrozen earlier layers. Earlier I trained the network with just 2-3 epochs and stopped as I could see training and validation loss diverging. But to test the capability of model, I ran for 10 epochs and could see the training loss reduced to 0.09 ā€“ sign of clear overfitting. The network so far has achieved 82.6 % accuracy on validation set. What was the accuracy that you could achieve using any of the resnet models?

1 Like

@rishubhkhurana @jamesrequa Lets make a team there?

1 Like

You can find an answer here https://github.com/Cadene/pretrained-models.pytorch

Thanks that worked great for getting the probabilities! But my kaggle score is crazy low so I think there is some other issueā€¦Iā€™ll keep investigating.

@yinterian It looks like the training labels are not being one-hot encoded when I use ImageClassifierData.from_csv.

If I look at whats getting returned from csv_source it should be fnames,y,classes but when I look at y it is just the index of the class not one-hot encoded which it should be according to this label_arr = nhot_labels(label2idx, csv_labels, fnames, len(all_labels))

Itā€™s only 1-hot encoded if there are multiple labels per instance. Otherwise we can just use ints, which is faster and uses less memory.

Thanks @jeremy for clarifying, in that case I donā€™t know why my test preds are so bad lol :slight_smile: I was getting over 94% on training/validation. Iā€™ll dig into it furtherā€¦