-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Label
This process should speed up labeling objects in pics quite a bit. And allow you to to train your custom model with only the objects from other custom models you care about and name them how you wish. In most cases you should be able to just change the object name for any that are wrong. Pics and mapping files are copied to folder named by the variable labeled for review. If no objects were found they are copied to a folder named by the variable unlabeled for manual processing. If a pic already exists in trainPath then it is ignored.
-
Add new pics to the folder newPicPath is pointed at.
-
Edit the classes.txt in labeled as needed to have all the object names the model should be trained with. Note quickLabel will add any names returned not already in classes.txt. If adding to existing model you need to keep the order and placement at top of any objects in classes.txt before editing or you will invalidate previously done mapping files.
-
Run python quickLabel.py Note if not adding any new classes you may wish run with tests2Run = ["custom/"+trainedName] to have less to correct in the results.
-
If not already done, clone labelImg to ..\labelImg.
-
Run labelImg
-
Set Change Save Folder to labeled
-
Open labeled folder
-
Check each labeled object in each image to verify and adjust labels as needed. (Should mainly be removing dups and changing label names on some discovered objects.
-
Open unlabeled folder (assuming there are files in there)
-
Add labeled objects in each image as needed. Remove images if does not contain any training objects
-
Run python chkClasses.py to see how many examples each class has to train with.
-
Run python chkClasses.py X where X is the minimum number of required matches. As in python chkClasses.py 2 would only keep classes and move training files if there are at least 2 training examples. Mapping class numbers updated in mapping files before being moved. Run python chkClasses.py -h for more details. Note assumes all the classes in trainPath\classes.txt are used so map files in trainPath do not need to be remapped.
Run testTorch.bat to confirm setup is ready
You are now ready to run training. Locally you can use a script like runTrain.bat
For other training options see DeepStack training
Once done it is a good idea to run trainTest.py to see how well the model works. You can use the pics and mapping files in the debugPath folder to quickly add found objects you missed and adjust mappings for objects in training images that were not found in testing.
For the not found objects look for the files names [training image name].expected.jpg. Note zooming in when viewing the file with labelImg can help with adjusting the maps
Since "extra" objects might be dups, all found object images are saved along with and updated mapping file to the debugPath
Object missed can be easily added by copying the mapping file from debugPath
Classes not performing well can be removed with python rmClasses.py Note this backup to labeled