smigula
(Mitchell Murphy)
May 29, 2019, 11:48pm
1
Hi, I am trying to create a basic model that predicts if a pepper is mild, medium or hot just from an image. I followed a similar process as to the bear classifier (from lesson 2), downloaded the images from Google Images, placed them in 3 folders and used the same code to create a databunch:
tfms = get_transforms(flip_vert=True, max_lighting=0.1, max_zoom=1.1, max_warp=0.5, max_rotate=90)
np.random.seed(42)
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2,
ds_tfms=tfms, size=224, num_workers=4).normalize(imagenet_stats)
Even though I specified I would like to use 20% of my data as a validation set, the above code only created the train set. I have done some reading and cannot figure out why this is happening, any suggesstions?
muellerzr
(Zachary Mueller)
May 29, 2019, 11:52pm
2
Can you show what calling data
outputs after you make the databunch?
smigula
(Mitchell Murphy)
May 30, 2019, 1:23am
3
Train: LabelList (149 items)
x: ImageList
Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224)
y: CategoryList
hot,hot,hot,hot,hot
Path: /content/gdrive/My Drive/fastai-v3/data/peppers;
Valid: LabelList (37 items)
x: ImageList
Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224),Image (3, 224, 224)
y: CategoryList
medium,mild,mild,medium,medium
Path: /content/gdrive/My Drive/fastai-v3/data/peppers;
Test: None
muellerzr
(Zachary Mueller)
May 30, 2019, 1:26am
4
Your validation set is in there See Valid:
it has 37 items (or images in our case) which is about 20% of your overall images
smigula
(Mitchell Murphy)
May 30, 2019, 1:30am
5
Ah I see. I thought I was augmenting my data, how do I confirm this? (I suspect it is not augmenting at all as each epoch only takes a few seconds).
muellerzr
(Zachary Mueller)
May 30, 2019, 1:34am
6
You can call learn.show_batch(), and it is augmenting it too
smigula
(Mitchell Murphy)
May 30, 2019, 1:41am
7
Ah thanks so much! I guess what I was looking for was some stats on how much the data is being augmented…
muellerzr
(Zachary Mueller)
May 30, 2019, 1:47am
8
The documentation should have what you’re looking for then:
https://docs.fast.ai/vision.transform.html
Or do you mean individually per image?