Hello,
I was looking at some augmentation details at : Augmentation of TFliteModelMaker
and came across mosaic.py. I remember it beeing a quite good augmentation technique.
How would I integrade it into the training of a object_detector.EfficientDetLite0Spec
?
Regards Daniel
Hi @Daniel_Klauser,
Good experimentation with mosaic augmentation.You might have resolved the issue by this time . Now trying to add few pointers on the issue. First thing, the TFLite modelmaker is having issue with the python version 3.10 and above. However you can use it with python 3.9 version on linux machine.
In order to train with mosaic augmentation, you can write CustomData Loader using mosiac.py on your data and then integrate with the model maker code. Here is the sample code for CustomDataLoader. Modify according to your base code.
#import necessary libraries
#import Mosaic( ) from tensorflow_examples
class CustomDataLoader(DataLoader):
def __init__(self, dataset, mosaic_prob=0.5):
super().__init__(dataset)
self.mosaic = Mosaic( )
self.mosaic_prob = mosaic_prob
def _load_mosaic_images(self):
mosaic_images = [ ]
for image_path, label in self._dataset:
if np.random.rand() < self.mosaic_prob:
mosaic_image, mosaic_label = self.mosaic(image_path)
mosaic_image.append(mosaic_image, mosaic_label)
return mosaic_images
def from_mosaic(self)
self._dataset = self._load_mosaic_images()
return self
Thank You