This directory is used for generating and formatting a Duckietown-specific dataset which is then used to train a YOLOv5 model. Once trained the YOLOv5 model can be run using the DT_objdet repository on the same Github account. The dataset comprises real and simulated images from the publically available Duckietown dataset. Both real and simulated images are collected within the duckietown-lx environment. The model is trained using the Google Colab script found in this repository
If you would like to skip the training, use the following DT Token: dt1-3nT8KSoxVh4MnDRxovGLkXZDhPpgc4SzasJBTSxbRUfDguS-43dzqWFnWd8KBa1yev1g3UKnzVxZkkTbfeFCAD1kMCPQvvSVDYPfoXapvF29wVgdC7 in the constants.py file from the DT_objdet.
The list below states the prerequisites to use this directory.
- Cloned duckietown-lx repository.
-
Replace the
data_collection.pyandsetup_activity.pyfiles in theduckietown-lx/object-detection/directory with the two files with the same names found in thereplacefolder in this directory. These files contain modifications that extend the dataset to include labels for duckiebots. The main difference between thedata_collection.pyfiles is that the modified version in this directory file saves segmented images to the assets directory. Thesetup_activity.pyfile has modifications that are necessary to add duckiebot labels. -
Follow the instructions in the duckietown-lx/object-detection-lx\setup.ipynb notebook to download the real dataset. Ensure that your terminal is cd'ed into the
duckietown-lx/and then run thedata_collection.pyusing the following two lines below:dts code build dts code workbench --simulation --launcher data-collection
The simulation will automatically close when the specified number observations have been obtained.
-
Copy the images in the
assetdirectory of theduckietown-lx\object-detectiondirectory across to this directory. -
cd into this directory and run the
sim_image.pyandreal_image.pyfiles. Note that you will have to manually add the path to your directory in theDATASET_DIRvariable for each of these files. This should move all images and labels directory to thetrainandvalidationfolders. -
Run the
dataset_zip.py. This should zip up theduckietown_object_detection_dataset. Copy the dataset to a Google DrivePlease be aware that
- Do not rename the dataset zip file
- The file should be uploaded to the out-most "My Drive" area
-
Use the
DT_training.ipynbnotebook in this directory to train the YOLOv5 model. The notebook walks you through the procedure, after training there should be a folder in your Google drive where you can look at the training results.