= Path('example_data/monthly_data')
path ='july'
month
= [path/f'{month}/{f}' for f in os.listdir(path/f'{month}') if f.endswith('.tif')][:2] fnames
Augmentations
Helper functions to make working with Albumentations and Fast.ai easier
Patching for drone_detector.data classes
RegressionMask.affine_coord
RegressionMask.affine_coord (x:drone_detector.engines.fastai.data.Regres sionMask, mat=None, coord_tfm=None, sz=None, mode='nearest', pad_mode='reflection', align_corners=True)
RegressionMask can’t be long
type
AlbumentationsTransform
AlbumentationsTransform
AlbumentationsTransform (train_aug, valid_aug=None)
A transform handler for multiple Albumentation
transforms in simple classification or regression tasks.
SegmentationAlbumentationsTransform
SegmentationAlbumentationsTransform
SegmentationAlbumentationsTransform (aug)
A transform handler for Albumentation
transforms for segmentation tasks.
= [A.ToFloat(max_value=65535.0, always_apply=True),
transform_list =0.5,brightness_limit=.05, brightness_by_max=False),
A.RandomBrightnessContrast(p=1),
A.RandomRotate90(p=.5),
A.HorizontalFlip(p=.5),
A.VerticalFlip(p
A.CoarseDropout(),=65535.0, dtype=np.int16, always_apply=True)
A.FromFloat(max_value ]
= SegmentationAlbumentationsTransform(A.Compose(transform_list)) used_tfms
= TifSegmentationDataLoaders.from_label_func(path/f'{month}_2018', fnames, y_block=RegressionMaskBlock,
segm =partial(label_with_matching_fname,
label_func=path/'masks'),
path= [
batch_tfms #Normalize.from_stats(*stats)
],= [used_tfms],
item_tfms =1) bs
=[3,2,1]) segm.show_batch(channels
= get_image_timeseries(path,
files =['may', 'june', 'july', 'august', 'september', 'october'], masks='masks') months
= DataBlock(blocks=(MultiChannelImageTupleBlock,
dblock
RegressionMaskBlock),=lambda x: x,
get_items=get_all_but_last, get_y=get_last,
get_x=[
item_tfms
used_tfms
],=[
batch_tfms ])
= dblock.dataloaders(files[:1], bs=1) dls
=[3,2,1]) dls.show_batch(channels