This repository contains tools and scripts for image segmentation, model training, inference, and dataset management using YOLO and Roboflow.
- Download datasets from Roboflow interactively or via CLI
- Train YOLO segmentation models
- Run inference on images or folders (with GUI and CLI options)
- Deploy trained models to Roboflow
- Create and use polygon masks for region-of-interest inference
- Compare segmentation results with Aiforia outputs
- Python 3.8+ (tested with 3.11)
- See
image-segmentation/requirements.txt
for Python dependencies
- Clone the repository:
git clone https://github.com/your-org/multipark-aiml.git cd multipark-aiml/image-segmentation
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file inimage-segmentation/
with your Roboflow API key and paths:ROBOFLOW_API_KEY="your_roboflow_api_key" DATASET_PATH="./datasets" MODEL_PATH="./models"
python download_dataset.py --api-key <API_KEY> [--project <project_slug>] [--version <version>] [--dataset-format yolov11] [--dataset-path <path>]
If --project
is not provided, you will be prompted to select one interactively.
python train_yolo.py --dataset-dir <dataset_dir> [--epochs 100] [--imgsz 640] [--batch -1] [--device <device>] [--model yolo11n-seg]
python infer_yolo.py --model <model_path> --input-path <image_or_folder> --output-path <output_folder> [options]
Key options:
--no-colors
: Convert output to grayscale--sliding-window
: Use sliding window for large images--save-image
: Save visualization--save-geojson
: Save results as GeoJSON--use-geojson-mask
: Use a polygon mask for ROI
python gui_infer_yolo.py
A graphical interface will open for model selection and inference. (Tested on Mac, tested and not working on Linux CentOS.)
python deploy_model.py --model <model_path> --api-key <API_KEY> [--project <project_slug>] [--version <version>]
If --project
is not provided, you will be prompted to select one interactively.
python create_mask.py --image <image_path> [--output <output_geojson>]
Interactively draw a polygon on the image to create a GeoJSON mask.
python compare_aiforia.py --aiforia-csv <csv> --multipark-geojson <geojson> --output-path <dir> --pixel-size <size> [--image <img>] [--save-geojson] [--save-image]
- Keep your
.env
file inimage-segmentation/
and add it to.gitignore
. - Do not commit sensitive information (API keys, etc.) to version control.
- Use a virtual environment for Python dependencies.
See LICENSE for details.
For questions or contributions, please open an issue or pull request.