Easily convert AnyLabeling JSON into YOLO txt files!
This tool simplifies dataset preparation for YOLO models, whether you're processing a single JSON file or managing batch conversions with multiple labels
- Batch Conversion: Upload and process multiple JSON
- Label Selection: Choose specific labels for YOLO txt format or include all
- User-Friendly Interface: Intuitive GUI
- Detailed Logs: Monitor every step of the conversion process
- Error Handling: Skips invalid files and provides detailed error logs
- Python 3.8 or newer
To get started, clone the repository to your local machine:
# Clone the repository
git clone https://github.com/danilobirbiglia/Any2YOLO.git
# Navigate into the project directory
cd Any2YOLONote: The tool is not fully optimized for Linux/macOS. Some features may have limited functionality
Install tkinter and Pillow:
sudo apt-get install python3-tk -y
pip install Pillow- Ensure Python is installed with the tcl/tk and IDLE option enabled during the installation process
- Then, install
Pillowusing:pip install Pillow
To confirm that tkinter is properly installed, run:
python -m tkinterIf a small GUI window appears, tkinter is correctly installed
-
Install dependencies:
# Install Python dependencies pip install Pillow -
Run the application:
python src/main.py
-
Follow the on-screen instructions to upload and convert your JSON files
- Run the App: Start the GUI with
python src/main.py - Upload Files: Click the "📂 Upload JSON Files" button to select one or more files
- Review Labels: View and select labels extracted from your JSON files
- Convert Files: Click "Convert" to generate YOLO compatible
.txtfiles - Access Results: Converted files are saved in the same directory as the input JSON files
| Folder/File | Description |
|---|---|
src/main.py |
Entry point for the application |
src/gui.py |
GUI logic for file management and conversion controls |
src/converter.py |
Core logic for JSON to YOLO conversion |
src/logger.py |
Manages logging for debugging and troubleshooting |
src/styles.py |
Defines styles for the GUI application |
assets/any2yolo.ico |
Icon for the GUI |
logs/converter.log |
Directory for log |
README.md |
Project documentation (you’re reading it!) |
{
"shapes": [
{
"label": "dog",
"points": [[100, 200], [300, 400]],
"shape_type": "polygon"
},
{
"label": "cat",
"points": [[50, 50], [150, 150]],
"shape_type": "polygon"
}
],
"imageWidth": 500,
"imageHeight": 500
}0 0.4 0.6 0.4 0.4
1 0.2 0.2 0.2 0.2Steps Taken:
- Extracted labels:
dog,cat - Calculated bounding box dimensions and coordinates
- Converted to YOLO txt
Detailed logs are available through the "Logs" menu in the app
Example Log Output:
INFO: Initialized with files: ['annotations.json']
INFO: Extracted labels: ['dog', 'cat']
INFO: Successfully converted annotations.json to annotations.txt
WARNING: Skipped invalid shape in annotations.json
The app skips invalid files and logs the issue for review
Yes! YOLO txt files support both polygons and bounding boxes
This project is licensed under the MIT License
- Created by: Danilo Birbiglia
- LinkedIn: Danilo Birbiglia
- Email: danilobirbiglia@gmail.com