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'
NathanYee
(Nathan Yee)
January 5, 2018, 3:26am
368
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
GregFet
(Greg Fetisov)
January 12, 2018, 4:02pm
370
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
ecdrid
(ecdrid)
January 12, 2018, 5:32pm
371
TTA has changed in its workingâŚ
In lesson 2 Jeremy said TTA() return the log probs, and to obtain the actual probabilities we need to calculate the exponential (np.exp) of returned values.
while doing predictions on planet amazon data set, I got 48% f2 score when I used the np.exp of probs returned byTTA(). My accuracy jumped to 93% (also actual accuracy shown while running epochs).
There is also no negative value in probs returned by TTA().
[Screenshot from 2018-01-10 03-46-07]
Link to my notebook. https://github.com/irshâŚ
3 Likes
GregFet
(Greg Fetisov)
January 12, 2018, 7:29pm
372
thank you for so fast reply!
raja4net
(Raja Rupinder Singh)
January 31, 2018, 8:33pm
373
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.
lukebyrne
(Luke Byrne)
February 4, 2018, 6:45am
374
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
jeremy
(Jeremy Howard)
February 4, 2018, 7:48am
375
lukebyrne:
torch.cuda.set_device(1)
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
lukebyrne
(Luke Byrne)
February 4, 2018, 10:27am
376
@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
mrgold
February 9, 2018, 12:07pm
377
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
farlion
(Florian Peter)
February 9, 2018, 12:09pm
378
Move it one folder deeper into fastai/fastai
1 Like
farlion
(Florian Peter)
February 11, 2018, 12:34pm
380
@bushaev Did you ever solve this? For me, itâs now working only on inception_4
.
bushaev
(Vitaly Bushaev)
February 11, 2018, 12:47pm
381
hmm, I donât really remember anymore 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.
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.