Part 2 Lesson 8 wiki


(Naresh) #289

I guess accessing images from internet to train a model would be very slow as we add up network latency. I would prefer to download it. Further, u may have to train test for multiple times. Accessing the data from internet in that case can be would not be recommendable. Furthermore, if there is a network issue during the training, the process will fail abruptly I believe. We may have to handle those cases.


(Naresh) #290

I am having issue while running ImageClassifier.from_csv.
This is the line of codes I have

PATH=‘data/pascal-localisation’
JPEGS=‘JPEGImages’
CSV=‘data/pascal-localisation/tmp/lrg.csv’
tfms = tfms_from_model(f_model, sz, aug_tfms=transforms_side_on, crop_type=CropType.NO)
md = ImageClassifierData.from_csv(PATH, JPEGS, CSV, tfms=tfms, bs=bs)

With error stack trace:

IndexError Traceback (most recent call last)
in ()
3 CSV=’…/data/pascal-localisation/tmp/lrg.csv’
4 tfms = tfms_from_model(f_model, sz, aug_tfms=transforms_side_on, crop_type=CropType.NO)
----> 5 md = ImageClassifierData.from_csv(PATH, JPEGS, CSV, tfms=tfms, bs=bs)

~/anaconda3/lib/python3.6/site-packages/fastai/dataset.py in from_csv(cls, path, folder, csv_fname, bs, tfms, val_idxs, suffix, test_name, continuous, skip_header, num_workers)
351 “”"
352 fnames,y,classes = csv_source(folder, csv_fname, skip_header, suffix, continuous=continuous)
–> 353 ((val_fnames,trn_fnames),(val_y,trn_y)) = split_by_idx(val_idxs, np.array(fnames), y)
354
355 test_fnames = read_dir(path, test_name) if test_name else None

~/anaconda3/lib/python3.6/site-packages/fastai/dataset.py in split_by_idx(idxs, *a)
364 def split_by_idx(idxs, *a):
365 mask = np.zeros(len(a[0]),dtype=bool)
–> 366 mask[np.array(idxs)] = True
367 return [(o[mask],o[~mask]) for o in a]

IndexError: arrays used as indices must be of integer (or boolean) type

I felt that its due to the wrong folder location. I ran the code from github pointing to the correct folder, it worked. Later, I moved my ipynb to the same folder and ran one more time. It ran. But When I run from the actual location I am intending to run, it fails with the above error. I am truck with this error for a couple of days. Any help would help.


(Peter Correia) #291

Looking into the VOC Documentation I received the impression the bbox was represented as such:
[x_min, y_min, x_max, y_max]
[155, 96, 196, 174] <- car bbox

How did you know that the last two items in the bounding box list represented width and height?


#292

Hi Vijay,

Followed these exact steps and I’m still not able to use symbols. I extracted to C:\Program Files\Microsoft VS Code\bin which is in my PATH when I run set command at the terminal and I still can’t search for something like open_img. Any thoughts?


(Vijay Kumar) #293

Hope you have selected the interpreter, with fastai environment (environment.yml) available with downloaded code.
Once interpreter set you are able to navigate.