Python based GUI for marking bounded boxes of objects in images for training Yolo v3 and v2 https://github.com/AlexeyAB/darknet. You can generate your own YOLO format custom data with yolo-labeling-tool
.
You should put the files listed below together.
contains the main codes.
project_name : "str" key_1 : label_name_1 key_2 : label_name_2 ... key_9 : label_name_9The class number(label number) which would be stored in the result file started from 0.
These configs must follow the json format.
- start.png : show when the job started
- end.png : show when the job finished
Of course, you can use your own images.
After marking bounding boxes and labelling, you need to make
.data
,.names
, list oftrain data
andtest data
files. This python codes will help you to write those files with simple action.
First of all, install the dependecies.
pip install -r requirements.txt
Before start the program, edit config.json
file as your needs.
Now, you can run the program by executing the code with python.
python main.py
Now, you are ready to start generating you own train data.
You will see the window above. Press Input Path
button and select a directory where your training images are. If you check Crop Mode
, your bounding boxes will be saved separately by cropping. You can specify where crop results to be saved by pressing Save Path
button. And then, press Next
button to start the main process.
Now, you can draw bounding boxes by draging on the image. After drawing a box, you should tag the box by pressing 1-9. The num:label name
setting should be specified in config.json
in advance. You can change the last box's tag by pressing tagging button again. If you find earlier mistakes, then remove the wrongly drawn box by clicking it with Right mouse button.
Each time you click Next
button or press E, your work will be saved image by image in a .txt
file which has same filename of the image. Cropped images will be saved in specified directory at this time.
For now, if you want to edit boxes of previous image, you need to delete the txt file of that image.
To write nessesary files for training Yolo, run create_file_list.py
. Select a directory where all data are. Answer whether you want to split the data into train and test or not. If yes, enter the train data ratio. Then those four files below will be automatically generated.
.data
: comprehensive information.names
: class informationtrain data
: list of train data directorytest data
: list of test(validate) data directory
And it will copy the test data images in test_data
directory. The only thing left is making .cfg
file which represent the inner structure of your network. yolo-labeling-tool
cannot help you make .cfg
. Find out the details of building custom data in ultralytics/yolov3.
Button | Description |
---|---|
Left | Draw box |
Right | Remove box |
Shortcut | Description |
---|---|
1-9 | Tag the last box |
ESC | Cancel The Last Box |
Q | Cancel All Boxes |
E | Next button |
A | Auto Labeling Mode |
If you want to build .exe
file, use pyinstaller.
pip install pyinstaller
pyinstaller --onefile --noconsole main.py
You need to carry config.json
, start.png
, end.png
with your .exe
as well.
github | https://github.com/YongWookHa/ |
ywha12@gmail.com |
enjoy the code.