Fastai Transforms for DonkeyCar

1 minute read

Published:

Intro

After a long hiatus from ML/robotics I’m trying to get back to it.

One of things I’m trying to do is switch all of my code over to PyTorch and fastai. One of the features that fastai offers is a set of image augmentations they call Transforms. I thought I’d try training some DonkeyCar models and see how much the Transforms help.

Methods and Results

transforms=[None,
            RandomResizedCrop(128,p=1.0,min_scale=0.5,ratio=(0.9,1.1)),
            RandomErasing(sh=0.2, max_count=6,p=1.0),
            Brightness(max_lighting=0.4, p=1.0),
            Contrast(max_lighting=0.4, p=1.0),
            Saturation(max_lighting=0.4, p=1.0)]
TransformValidation Loss (mean)Std
None0.13520.0030
Brightness0.13980.0028
Contrast0.13820.0030
RandomErasing0.13610.0015
RandomResizedCrop0.16380.0022
Saturation0.13720.0031

Transformed images

These are sample images from each Transform, using parameters I chose after manually inspecting a range of values.

No Transform

RandomResizedCrop

RandomErasing

Brightness

Contrast

Saturation

Conclusions

None of the Transforms, when used individually, made a noticeable improvement. RandomResizedCrop may even have been worse.

For now, at least, I won’t be using anything except Resize, to get my images to the correct input size.

Future

  • Instead of comparing validation loss, try running each trained model in the simulator and compare number of laps and lap times.
  • Rerun with more data, especially when I start training on more than one track.