https://github.com/rightpoint/customvisiontools
Useful utilities for training object detection models with Custom Vision.
https://github.com/rightpoint/customvisiontools
Last synced: about 1 year ago
JSON representation
Useful utilities for training object detection models with Custom Vision.
- Host: GitHub
- URL: https://github.com/rightpoint/customvisiontools
- Owner: Rightpoint
- License: mit
- Created: 2020-09-21T19:04:56.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-09-25T17:48:07.000Z (over 5 years ago)
- Last Synced: 2025-02-16T00:48:19.572Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CustomVisionTools
CustomVisionTools is a macOS command line toolset for working with [Custom Vision](https://www.customvision.ai/)'s object detection training. These tools make it easy to upload or download images and bounding box data, as well as augmenting your images to make your trained models much more robust.
## Setup
You'll need Python 3.7 or higher and Homebrew installed.
Clone this repo. In the root of the repo, open the terminal and run the following:
```sh
brew install poetry # Dependency manager, see https://github.com/python-poetry/poetry#installation
poetry install # Install dependencies
```
Then you can start editing the code:
```sh
poetry shell
code . # Or whatever you want
```
## Usage
### Download
This downloads all the images and bounding boxes in the project into a folder. The data will be saved in YOLO Darknet format.
```
poetry run ./download.py --endpoint --training_key --project_id --output_directory ./downloads
```
Parameters:
* `--endpoint`: "Endpoint" from Custom Vision project settings.
* `--training_key`: "Key" from Custom Vision project settings.
* `--project_id`: "Project Id" from Custom Vision project settings.
* `--output-directory`: The directory that you want the data saved into.
### Upload
This uploads a folder to the specified project on Custom Vision.
```
poetry run ./upload.py --endpoint --training_key --project_id --input_directory ./downloads
```
Parameters:
* `--endpoint`: "Endpoint" from Custom Vision project settings.
* `--training_key`: "Key" from Custom Vision project settings.
* `--project_id`: "Project Id" from Custom Vision project settings.
* `--input-directory`: The directory that you want to upload from. The folder must be in YOLO Darknet format.
Additional flags:
* `--add_superfluous_regions`: Setting this flag adds an extra useless region to 15 images.
- If there's only one tag in a Custom Vision model and you export it to a CoreML model, it won't work when used. This fixes that bug.
- Custom Vision requires a minimum of 15 images to be associated with a tag for it to get used.
### Augment
This applies the augmentations specified in `get_augmentation_operations()` of `MyAugments.py` to every image in the input directory using [imgaug](https://github.com/aleju/imgaug). `MyAugments.py`, the original images, and the augmented images are then written to the output directory. You can upload the resulting directory using `upload.py`.
```
poetry run ./augment.py --input_directory ./downloads --output_directory ./augmented
```
Parameters:
* `--input-directory`: The directory that you want to augment. This must be a YOLO Darknet-formatted folder.
* `--output-directory`: The directory that you want the data saved into.
Additional flags:
* `--skip_originals`: Avoid copying input images into the output directory.
* `--preview_only` or `-p`: Preview augmentations without writing to any files.
* `--single_threaded` or `-s`: Perform augmentations on multiple threads.
## Similar projects:
- https://kevinsaye.wordpress.com/2020/05/01/uploading-and-downloading-content-from-custom-computer-vision/