Here are some utility python codes that can help you label your pictures. These codes allows you to surround your object with visualized square lables and translate them into the appropriate form for running yolo. Below are simple descriptions of what each python code does.
Executes the labeling program.
How to use :
- Requires a "class.txt" file that identifies class names in separate lines.
- Requires an "Examples/demo/" directory that stores 3 demo images(Don't know whether random images work).
- Once the program appears on screen, specify the directory for your images and hit "Load". You will see your very first image file in the center.
- Next, select object class and hit "Confirm" for the object you want to label.
- Click to label. Only 2 clicks are required for labeling an object. Just to be safe, it is recommended that you click from the upper-left corner to the lower-right corner.
- Delete inserted labels by selecting and hitting "Delete" to delete a selected label, or click "ClearAll" to delete all labels for a single image.
- Each visualization of label is stored in ".txt" format inside "Labels/{your directory number}/"
Removes redundant images with no label and empty label files.
How to use :
- Specify the path to your images and label text files in code. Where to fix is self-evident.
Converts labels to appropriate form for feeding yolo network.
How to use :
- Specify the path to your label text files and path to save the converted labels.
Creates a list of train set and test set in separate ".list" files. They are named "train.list" and "test.list"
How to use :
- Specify the directory where your Label_formal files reside and where your images reside.
- Specify the percentage to make your test set. [0,100] The remainder will become the train set.
In case the original label files are lost, use this code to convert your Label_formal files back to the original label files.
How to use :
- Specify path to Label_formal files and the to-be-generated Label files.
Augment your images by adding blur or noise to your images. You can also rotate your image by 180 degrees.
How to use :
- Set parameters for augmentation.
Create a list of all ".jpg" files resident in the current directory. The files are enlisted in order.
How to use :
- Just run the code!
Create a shuffled list of all ".jpg" files resident in the current directory.
How to use :
- Just run the code!
Rename files in current directory by replacing a certain expression to another.
How to use :
- Modify replace( {src} , {dst} ) and run.
Shell script to convert newline from DOS format to UNIX format.
How to use :
- In UNIX device : type "./format.sh {your file name}" and hit enter.
- Name says format_"list".sh, but it actually works on all files. Cheers.
- Strongly advised that Images, Labels, Labels_formal directories be made identically as the provided templates(relative path from source code as well). You can keep things lot simpler this way.
- Codes without indices (augment, makelist and rename) are meant to be used just before training or testing in darknet. They work for images and corresponding labels residing in the same directory as themselves, so they should be copied to the path to your darknet dataset before use. Be sure that non-relevant .jpg or .txt files are not included in the directory(Otherwise they will be considered a part of your training / test sets).
- Might have to convert DOS codes to UNIX codes before use.