Dog Breed Identification challenge

Hi Jeremy, when I use

tfms = tfms_from_model(arch, sz, aug_tfms=transforms_side_on, max_zoom=1.1)
data = ImageClassifierData.from_csv(PATH, 'train', f'{PATH}labels.csv', test_name='test', num_workers = 4, val_idxs=val_idxs, suffix = '.jpg', tfms=tfms, bs=bs)

this works fine, but when I try to run
data.test_ds

The error shows
AttributeError: 'ImageClassifierData' object has no attribute 'test'

what is the output of: !ls {PATH}

get-pip.py sample_submission.csv test.zip
labels.csv sample_submission.csv.zip train
labels.csv.zip test train.zip

this is the output

Hi @sermakarevich, @jeremy and everyone!

I have a error when counting accuracy:

so when i run

log_preds,y = learn.TTA()
probs = np.exp(log_preds)
accuracy(log_preds,y), metrics.log_loss(y, probs)

I get:

AttributeError                            Traceback (most recent call last)
<ipython-input-25-ceca03c60965> in <module>()
  1 log_preds,y = learn.TTA()
  2 probs = np.exp(log_preds)
----> 3 accuracy(log_preds,y), metrics.log_loss(y, probs)
    ~/fastai/courses/dl1/fastai/metrics.py in accuracy(preds, targs)
      4 def accuracy(preds, targs):
      5     preds = np.argmax(preds, axis=1)
    ----> 6     return (preds==targs).mean()
      7 
      8 def accuracy_thresh(thresh):

`AttributeError: 'bool' object has no attribute 'mean'`

it is happens when indicator is 3/4 or 4/4

Do you have some idea how to fix it?

1 Like

TTA has changed in its working…

3 Likes

thank you for so fast reply!

Hi! The shape of my probability is [120,]. How can I write it to csv file for kaggle submission?

Edit: There was some error in learn.TTA() function. Got it right and submitted my first file to the competition. Thanks @jeremy for this great course.

Hi all,

I am following along with the lesson.

I am getting this error on a Paperspace GPU Hourly after running the cell

torch.cuda.set_device(1)

RuntimeError: cuda runtime error (10) : invalid device ordinal at torch/csrc/cuda/Module.cpp:88

From what I am reading I have a feeling it is a driver error but I am unsure how to resolve.

Any help greatly appreciated.

Kind regards,

Luke

You shouldn’t run that - that’s only if you have multiple GPUs. Where did you see this?

BTW, you may find this helpful more generally: http://wiki.fast.ai/index.php/How_to_use_the_Provided_Notebooks

@jeremy I saw that on the video for lesson 2 when you were running through dog breed Kaggle challenge.

I have just been pausing the video and typing out whats in the cells.

2 Likes

Having also issue while trying to runt his line in paperspace:
ConvLearner.pretrained(arch, data)

Error message:
No such file or directory: ‘/home/paperspace/fastai/courses/dl1/fastai/weights/resnext_101_64x4d.pth’

I’ve download the weight files and it’s save in fastai folder

I guess this error is related to the path but not sure how to solve it

Move it one folder deeper into fastai/fastai :slight_smile:

1 Like

Pure magic, thx farlion!

1 Like

@bushaev Did you ever solve this? For me, it’s now working only on inception_4.

hmm, I don’t really remember anymore :smiley: I don’t think I did, I probably just used models that worked.

I am getting an error on:
test = pd.DataFrame(np.exp(test))
Value error: Must pass 2-D input.

test = learn.TTA(is_test=True)[0] returns object of shape (5, 10357, 120)

Fixed it.
Just learning to browse through these forums. :slight_smile:

I’ve been wondering about the get_cv_idxs(n) and creating a validation set. Is it important to generate a validation set with the same distribution as the training set?

In the implementation, it takes n_val +1 indices from a random permutation based on parameter ‘n’. Would it be beneficial to take indices based on the distribution of the images? Or does that not really change anything?

Signature: get_cv_idxs(n, cv_idx=0, val_pct=0.2, seed=42)
Source:   
def get_cv_idxs(n, cv_idx=0, val_pct=0.2, seed=42):
    np.random.seed(seed)
    n_val = int(val_pct*n)
    idx_start = cv_idx*n_val
    idxs = np.random.permutation(n)
    return idxs[idx_start:idx_start+n_val]
File:      ~/fastai/courses/dl1/fastai/dataset.py
Type:      function

Yes have you read http://www.fast.ai/2017/11/13/validation-sets/ ?
Also look at k-fold cross validation as an option

2 Likes

So at the moment, this is not covered in the get_cv_idxs() method.