Lesson 3: Multilabel image classification

(Viola Lewis) #1

Hi. I tried experimenting a bit with my own dataset for multilabel image classification. When I upload my .Zip dataset from my PC to Kaggle I notice that the images flip. This is evident before the databunch creation step when i try to display the images from my uploaded input dataset. My input images have faces which i do not want to flip. Is there some option to prevent flip when creating the .Zip and upload to Kaggle?

Also, could this be the reason why i get a very low accuracy (60%) on my mulilabel classification model? I have used the same code framework as in Lesson3 of the course. Should i instead be pre-processing my input images to crop only the faces?

Any help would be much appreciated.
Thank you

(Coral) #2

Not sure how your code is like, but there seems to be some default dataset transforms that are preset and can be turned off. Refer to documentation below


Help on function get_transforms in module fastai.vision.transform:

get_transforms(do_flip: bool = True, flip_vert: bool = False, max_rotate: float = 10.0, max_zoom: float = 1.1, max_lighting: float = 0.2, max_warp: float = 0.2, p_affine: float = 0.75, p_lighting: float = 0.75, xtra_tfms: Union[Collection[fastai.vision.image.Transform], NoneType] = None) -> Collection[fastai.vision.image.Transform]
Utility func to easily create a list of flip, rotate, zoom, warp, lighting transforms.

(Viola Lewis) #3

Thank you so much for your reply to my query. I really appreciate it.

This is the sequence of steps in my code:

  1. Read input images (Uploaded to Kaggle in a .zip folder). Kaggle allows to access the input images without performing an unzip therefore I’m reading the images as is from the .zip uploaded folder.

  2. Display input image. When i view my image in this step it is flipped horizontally.

     _img = open_image(path/'trainjpg'/'train-jpg'/'train_52.jpg' )_
  3. Next I perform the get_transforms step with the following parameters.

_tfms = get_transforms(do_flip=False, flip_vert=False,max_lighting=0.1, max_zoom=1.05, max_warp=0.)

As you can see above the images are flipped horizontally in step 2. even before i perform the get_transforms in step 3. Do you think the images are getting flipped horizontally during the upload to Kaggle? Should I unzip before accessing the images in my code?

Thank you once again.