Jovian
⭐️
Sign In
In [1]:
from fastai.vision import *
In [7]:
images_path = untar_data(URLs.CARS)
In [8]:
images_path.ls()
Out[8]:
[PosixPath('/home/jupyter/.fastai/data/stanford-cars/cars_train'),
 PosixPath('/home/jupyter/.fastai/data/stanford-cars/cars_annos.mat'),
 PosixPath('/home/jupyter/.fastai/data/stanford-cars/cars_test'),
 PosixPath('/home/jupyter/.fastai/data/stanford-cars/car_ims')]
In [20]:
data_src = ImageList.from_folder(images_path/'cars_train').split_none().label_const('cars')
In [21]:
tmfs = get_transforms(
    do_flip=True, 
    max_rotate=10, 
    max_zoom=1.5,
    max_lighting=0.3,
    xtra_tfms=[
        jitter(magnitude=0.01, p=0.5),
        rgb_randomize(channel=0, thresh=0.9, p=0.1),
        rgb_randomize(channel=1, thresh=0.9, p=0.1),
        rgb_randomize(channel=2, thresh=0.9, p=0.1),
    ]
)

data = data_src.transform(tmfs, size=224).databunch()
In [22]:
data
Out[22]:
ImageDataBunch;

Train: LabelList (8144 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
cars,cars,cars,cars,cars
Path: /home/jupyter/.fastai/data/stanford-cars/cars_train;

Valid: LabelList (0 items)
x: ImageList

y: CategoryList

Path: /home/jupyter/.fastai/data/stanford-cars/cars_train;

Test: None
In [23]:
data.show_batch(rows=3)