Training the Object Detector requires a dataset of images, annotated with the bounding boxes of each object identified in each image.
There are two possible ways to create traiing data:
-
CloudAnnotation To easily create annotated image datasets, we can use the Cloud Annotation Tool, a fast, easy and collaborative open source image annotation tool that makes it easy interactively draw bounding boxes around objects in images residing on IBM Cloud Object Storage.
-
LabelImg + conversion in Python
Follow the instructions in this document to prepare your data for training the object detector model.
Login into Cloud Annotation Tool using your IBM Cloud credentials.
-
Choose the configured input bucket from the available buckets.
NOTE : The configured input bucket name can be obtained from the credentials displayed after running the setup script.
------------------------------------------------------------------------------ NEW YAML CONFIGURATION VALUES ------------------------------------------------------------------------------ input_bucket : object-detector-input local directory : ../data result bucket : object-detector-output compute : k80 ------------------------------------------------------------------------------
- Choose
Localization
from the options displayed on the screen and clickConfirm
.
- Data uploaded during setup will be available inside the bucket for annotation. Click on
Add Label
to add class names.
- Add the class names before proceeding with the annotation process.
Continue adding label names if there are multiple objects for detection.
- Click on the image to start the annotation process. Select an appropriate label from the list displayed on the right side of the screen. Draw bounding box around the image. Follow the same steps for other images.
- To view only unlabeled images, click on
unlabeled
option on the bottom of the screen.
Once you have completed annotating all your images, proceed to training parameter customization and initiate training.
<Clone labelImg from: Github labelImg <Follow instructions in the README.md to get it running. <Create a new folder under /training, for example: 'sample_pictures' (this is your $DATA_DIR int he training project) <Create a subfolder called 'data' in /training/sample_pictures <Copy all the your images
How to use the tool:
<< Click 'Open Dir' and navigate to the folder where all the picture are stored you want to annotate. All will be loaded to the tool.
<< Click 'Create RectBox' on the left side and draw a rectangle over the part of the picture you want to annotate
<<From the pop-up window either select an existing label or add a new one.
<<Currently you can only add one annotation per picture. (should/would be extended in the future)
<<< Click save
<The xml files will be saved in the same folder where you had the pictures. <Move the xml-s one folder-level higher: in /training/sample_pictures ($DATA_DIR)
The train-command.sh contains a new step to call xml2json for the $DATA_DIR that was defined in prepare_envs.sh. The output will be _annotations.json in the $DATA_DIR