### Full YOLO-MLX Setup Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs YOLO-MLX and its tracking dependencies, setting up a virtual environment. ```bash cd yolo-mlx # Create and activate virtual environment python3 -m venv .venv source .venv/bin/activate # Install the package pip install -e . # Install tracking dependencies (OpenCV, lap, scipy — required for model.track()) pip install -e ".[tracking]" ``` -------------------------------- ### Setup and Model Conversion for Training Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Prepares the environment and converts a YOLOv26 model to MLX format, serving as starting weights for fine-tuning. ```bash # 1. Setup (if not done already) cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[convert]" # 2. Download and convert a pretrained model as starting weights bash scripts/download_yolo26_models.sh yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify ``` -------------------------------- ### Setup and Model Conversion for Detection Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs YOLO-MLX with tracking and conversion dependencies, then downloads and converts a pretrained YOLO26 model for detection. ```bash cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[tracking]" pip install -e ".[convert]" bash scripts/download_yolo26_models.sh yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify ``` -------------------------------- ### Setup and Model Conversion for Tracking Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs necessary tracking dependencies and converts a YOLOv26 model to MLX format for multi-object tracking. ```bash # 1. Setup (if not done already) cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[tracking]" pip install -e ".[convert]" # 2. Download and convert a model bash scripts/download_yolo26_models.sh yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify # 3. Download MOT17 and create a sample pedestrian video (~3s, 1080p) bash scripts/download_mot17.sh python scripts/create_sample_video.py # creates images/pedestrians.mp4 ``` -------------------------------- ### Setup and Model Conversion for Segmentation Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs YOLO-MLX with segmentation and conversion dependencies, then downloads and converts a pretrained segmentation model. ```bash # 1. Setup cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[segment]" pip install -e ".[convert]" # 2. Download a pretrained segmentation model and convert to MLX format bash scripts/download_yolo26_models.sh # downloads all .pt weights to models/ yolo-mlx converters convert models/yolo26n-seg.pt -o models/yolo26n-seg.npz --verify # 3. Run segmentation mkdir -p images curl -fsSL -o images/bus.jpg https://ultralytics.com/images/bus.jpg ``` -------------------------------- ### Setup and Model Conversion for Segmentation Training Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs YOLO-MLX with segmentation and conversion dependencies, then downloads and converts a pretrained segmentation model for training. ```bash # 1. Setup (if not done already) cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[segment]" pip install -e ".[convert]" # 2. Download and convert a pretrained segmentation model as starting weights bash scripts/download_yolo26_models.sh yolo-mlx converters convert models/yolo26n-seg.pt -o models/yolo26n-seg.npz --verify ``` -------------------------------- ### Set Up Development Environment Source: https://github.com/thewebai/yolo-mlx/blob/main/CONTRIBUTING.md Installs the project and development dependencies in a virtual environment. ```bash python3 -m venv .venv source .venv/bin/activate pip install -e .[dev] ``` -------------------------------- ### Install Weight Conversion Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Installs packages necessary for converting model weights from PyTorch (.pt) to MLX (.npz) format. This is a one-time setup for conversion. ```bash # Install weight conversion dependencies (needed once to convert .pt → .npz) pip install -e "[convert]" ``` -------------------------------- ### Setup: Download MOT17 Dataset and Create Sample Video Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Downloads the MOT17 dataset and creates a sample video file for tracking demonstrations. ```bash # ── Setup: Download MOT17 & create sample video ── bash scripts/download_mot17.sh python scripts/create_sample_video.py ``` -------------------------------- ### Activate Environment and Setup Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Commands to activate the project environment, download models, and convert them for use with YOLO-MLX. ```bash # Activate environment cd yolo-mlx source .venv/bin/activate # ── Setup: Download models & convert ── bash scripts/download_yolo26_models.sh yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/thewebai/yolo-mlx/blob/main/CONTRIBUTING.md Installs the pre-commit framework to automatically check code quality before commits. ```bash make pre-commit-install ``` -------------------------------- ### Install Conversion Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/CONTRIBUTING.md Installs additional dependencies required for weight conversion tasks. ```bash pip install -e .[convert] ``` -------------------------------- ### Install Conversion Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs dependencies required for converting model weights from .pt to .npz format. ```bash pip install -e ".[convert]" ``` -------------------------------- ### Install Optional Benchmark Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Installs PyTorch and torchvision for running optional benchmarks comparing MLX performance against PyTorch MPS/CPU. ```bash # (Optional) Install PyTorch MPS/CPU comparison benchmarks pip install torchvision # optional, for MPS/CPU benchmarks ``` -------------------------------- ### Setup and Model Conversion for Inference Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Sets up the environment and converts a YOLOv26 model to MLX format for inference. Ensure you are in the yolo-mlx directory. ```bash cd yolo-mlx python3 -m venv .venv && source .venv/bin/activate pip install -e . pip install -e ".[convert]" bash scripts/download_yolo26_models.sh # downloads all .pt weights to models/ yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify mkdir -p images curl -fsSL -o images/bus.jpg https://ultralytics.com/images/bus.jpg ``` -------------------------------- ### Install YOLO26 MLX and Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Install the yolo-mlx package and its core dependencies. Also install optional dependencies for weight conversion, COCO evaluation, and PyTorch comparison benchmarks. ```bash # Install yolo-mlx and its core dependencies (mlx, numpy, pillow, pyyaml, tqdm) pip install -e . # Install weight conversion dependencies (needed once to convert .pt → .npz) pip install -e ".[convert]" # Install COCO evaluation and chart generation tools pip install pycocotools matplotlib # (Optional) Install PyTorch MPS/CPU comparison benchmarks pip install torchvision # optional, for MPS/CPU benchmarks ``` -------------------------------- ### Install YOLO26 MLX Weight Conversion Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Installs additional dependencies required for converting PyTorch model weights (.pt) to MLX format (.npz). This is typically a one-time setup. ```bash # Install weight conversion dependencies (needed once to convert .pt → .npz) pip install -e ".[convert]" ``` -------------------------------- ### Install COCO Evaluation and Charting Tools Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Installs tools necessary for COCO dataset evaluation (mAP) and generating performance charts. ```bash # Install COCO evaluation and chart generation tools pip install pycocotools matplotlib ``` -------------------------------- ### Install YOLO26 MLX and Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Install the yolo-mlx package and its core, tracking, and conversion dependencies using pip. ```bash # Install yolo-mlx and its core dependencies (mlx, numpy, pillow, pyyaml, tqdm) pip install -e . # Install tracking dependencies (OpenCV for video I/O, lap for assignment) pip install -e ".[tracking]" # Install weight conversion dependencies (needed once to convert .pt → .npz) pip install -e ".[convert]" ``` -------------------------------- ### Install Optional PyTorch Comparison Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Installs torchvision for optional benchmarking against PyTorch's MPS and CPU backends. ```bash # (Optional) Install PyTorch MPS/CPU comparison benchmarks pip install torchvision ``` -------------------------------- ### Manually Setup COCO Dataset Directories Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Manually creates directories and downloads necessary files for the COCO dataset if the automatic script is not used. This includes images, annotations, and labels. ```bash mkdir -p datasets/coco/images datasets/coco/annotations datasets/coco/labels curl -L -o datasets/coco/images/val2017.zip http://images.cocodataset.org/zips/val2017.zip unzip datasets/coco/images/val2017.zip -d datasets/coco/images/ rm datasets/coco/images/val2017.zip curl -L -o datasets/coco/annotations/annotations_trainval2017.zip http://images.cocodataset.org/annotations/annotations_trainval2017.zip unzip datasets/coco/annotations/annotations_trainval2017.zip -d datasets/coco/ rm datasets/coco/annotations/annotations_trainval2017.zip curl -L -o datasets/coco/labels/val2017.zip https://github.com/ultralytics/assets/releases/download/v0.0.0/coco2017labels-segments.zip unzip datasets/coco/labels/val2017.zip -d datasets/coco/ rm datasets/coco/labels/val2017.zip ``` -------------------------------- ### Install YOLO26 MLX Package and Core Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Installs the yolo-mlx package and its essential runtime dependencies using pip. ```bash # Install yolo-mlx and its core dependencies (mlx, numpy, pillow, pyyaml, tqdm) pip install -e . ``` -------------------------------- ### CLI Tracking with Frame Skipping Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Process only every Nth frame for faster tracking by setting the `--vid-stride` option. This example processes every second frame. ```bash # Skip frames for faster processing (process every 2nd frame) yolo-mlx track --model models/yolo26n.npz --source video.mp4 --vid-stride 2 --save ``` -------------------------------- ### Install Segmentation Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Installs additional packages required for instance segmentation tasks, including COCO mAP evaluation and mask visualization. ```bash # Install segmentation dependencies (pycocotools for COCO mAP, matplotlib for charts, opencv-python for masks) pip install -e "[segment]" ``` -------------------------------- ### Install Segmentation Dependencies Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Installs the necessary dependencies for segmentation tasks, including pycocotools, matplotlib, and opencv-python. This is required for model.predict() with task="segment", COCO mask mAP, and chart generation. ```bash pip install -e ".[segment]" ``` -------------------------------- ### YOLO-seg Label Format Example Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Illustrates the polygon vertex annotation format for segmentation labels. Each line specifies a class ID followed by normalized polygon coordinates. ```text class_id x1 y1 x2 y2 x3 y3 ... xN yN ``` ```text 0 0.123 0.456 0.234 0.567 0.345 0.678 0.456 0.789 0.123 0.456 45 0.500 0.200 0.600 0.300 0.700 0.400 0.500 0.200 ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Navigate to the project directory and create a Python virtual environment named .venv, then activate it. ```bash cd yolo-mlx # Create a new virtual environment python3 -m venv .venv # Activate it source .venv/bin/activate ``` -------------------------------- ### Activate Environment and Run Inference Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Quick reference to activate the project environment and run an inference benchmark for all models, skipping MPS and CPU backends. ```bash # Activate environment cd yolo-mlx source .venv/bin/activate # ── Inference benchmark (all models, MLX only) ── python scripts/benchmark_yolo26_seg_inference.py --skip-mps --skip-cpu ``` -------------------------------- ### All Options Combined for MLX Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Run the MLX YOLOv26-seg training benchmark with multiple custom options including models, epochs, and batch size. This demonstrates a comprehensive configuration. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Download MOT17 Dataset and Create Sample Video Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Download the MOT17 dataset for evaluation and create a sample pedestrian video from its frames using provided scripts. ```bash # Download MOT17 dataset (~5.5 GB) for evaluation and demo videos bash scripts/download_mot17.sh # Create a short sample pedestrian video (~3s, 1080p) from MOT17 frames python scripts/create_sample_video.py ``` -------------------------------- ### CPU Training Benchmark (All Models) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Run the PyTorch CPU training benchmark for all specified models. ```bash python scripts/benchmark_yolo26_training_cpu.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Activate Environment and Run Inference Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Activate the project's virtual environment and run the inference benchmark script for MLX only. ```bash cd yolo-mlx source .venv/bin/activate python scripts/benchmark_yolo26_inference.py --skip-mps --skip-cpu ``` -------------------------------- ### Benchmark YOLOv26-seg Training on PyTorch CPU (Full) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Run full training benchmarks for all YOLOv26-seg models using the PyTorch CPU backend. Specify multiple models, epochs, and batch size. ```bash # ── CPU training benchmark (all models) ── python scripts/benchmark_yolo26_seg_training_cpu.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### MLX Training Benchmark (All Models) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Run the MLX training benchmark for all specified models. ```bash python scripts/benchmark_yolo26_training_mlx.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Webcam Tracking via CLI Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Perform real-time object tracking from a webcam using the command-line interface. The `--show` flag displays the output. ```bash # Webcam tracking yolo-mlx track --model models/yolo26n.npz --source 0 --show ``` -------------------------------- ### Benchmark YOLOv26 Training (Specific Models and Settings) Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Runs training benchmarks for specific YOLOv26 models ('n', 's') with custom settings, including 10 epochs and a batch size of 4. ```bash python scripts/benchmark_yolo26_training_mlx.py --models n s --epochs 10 --batch 4 ``` -------------------------------- ### Collect and Chart Benchmark Results Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Collect all benchmark results and generate comparison charts. ```bash python scripts/benchmark_yolo26_collect_results.py python scripts/benchmark_yolo26_generate_charts.py ``` -------------------------------- ### Tracking Demo Script: Webcam Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Execute the tracking demo script for real-time webcam feed processing, enabling live display of tracking results. ```bash # Webcam tracking python scripts/track_demo.py --model models/yolo26n.npz --source 0 --show ``` -------------------------------- ### Benchmark Inference with Custom Warmup and Runs Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Configure custom warmup runs and timed runs for the inference benchmark script. ```bash python scripts/benchmark_yolo26_inference.py --warmup 5 --runs 15 ``` -------------------------------- ### CLI Tracking with BoT-SORT Tracker Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Utilize the BoT-SORT tracker instead of the default ByteTrack by specifying the tracker configuration file. ```bash # Use BoT-SORT instead of ByteTrack yolo-mlx track --model models/yolo26n.npz --source video.mp4 --tracker botsort.yaml --save ``` -------------------------------- ### Download Test Image for Inference Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Downloads a sample image to be used for testing and benchmarking inference. ```bash mkdir -p images curl -L -o images/bus.jpg https://ultralytics.com/images/bus.jpg ``` -------------------------------- ### Benchmark YOLOv26-seg Training on PyTorch MPS (Full) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Run full training benchmarks for all YOLOv26-seg models using the PyTorch MPS backend. Specify multiple models, epochs, and batch size. ```bash # ── MPS training benchmark (all models) ── python scripts/benchmark_yolo26_seg_training_mps.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Run Common Development Commands Source: https://github.com/thewebai/yolo-mlx/blob/main/CONTRIBUTING.md Executes common development tasks such as formatting, linting, and testing. ```bash make format make lint make test make check ``` -------------------------------- ### Collect Benchmark Results and Generate Charts Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Combine results from multiple benchmark runs and generate comparison charts. Requires matplotlib. Supports outputting charts in PDF format and customizing DPI and output directory. ```bash # Combine all JSON results into one file python scripts/benchmark_yolo26_seg_collect_results.py # Generate comparison charts python scripts/benchmark_yolo26_seg_generate_charts.py # PDF format (for publications) python scripts/benchmark_yolo26_seg_generate_charts.py --format pdf # Custom DPI and output directory python scripts/benchmark_yolo26_seg_generate_charts.py --dpi 300 --output my_charts/ ``` -------------------------------- ### Tracking Demo Script: Video File Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Run the standalone tracking demo script for video file processing, with options to display results and save the annotated output. ```bash # Video file tracking (display + save) python scripts/track_demo.py --model models/yolo26n.npz --source images/pedestrians.mp4 --show --save ``` -------------------------------- ### CLI Video Tracking with Display and Save Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Track objects in a video file using the CLI, displaying the results in real-time and saving the annotated video. ```bash # Track with display yolo-mlx track --model models/yolo26n.npz --source images/pedestrians.mp4 --show --save ``` -------------------------------- ### Run Segmentation Training Benchmarking with Custom Settings Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Benchmark segmentation training with specific models (e.g., 'n' and 's'), a custom number of epochs, and batch size. The output file can be specified using the --output flag. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --models n s --epochs 10 --batch 4 ``` -------------------------------- ### Configure MLX Training Benchmark Options Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Customize the MLX training benchmark by specifying models, epochs, batch size, learning rate, and output path. ```bash # Specific models only python scripts/benchmark_yolo26_training_mlx.py --models n s # Custom epochs and batch size python scripts/benchmark_yolo26_training_mlx.py --epochs 5 --batch 2 # Custom learning rate python scripts/benchmark_yolo26_training_mlx.py --lr 0.0001 # Custom output path python scripts/benchmark_yolo26_training_mlx.py --output my_results.json # All options combined python scripts/benchmark_yolo26_training_mlx.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Customize Sample Video Creation Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Modify the sample video creation script to use a different MOT17 sequence or frame count, or specify a custom output path. ```bash # Custom sequence and frame count python scripts/create_sample_video.py --sequence MOT17-04-SDP --frames 60 # Custom output path python scripts/create_sample_video.py --output my_video.mp4 ``` -------------------------------- ### Basic Video Tracking via CLI Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Track objects in a video file using the command-line interface. The `--save` flag stores the annotated video. ```bash # Track a video file yolo-mlx track --model models/yolo26n.npz --source images/pedestrians.mp4 --save ``` -------------------------------- ### Run All MLX Training Benchmarks Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Execute the MLX training benchmark script to train and evaluate all YOLOv26-seg models. The output is saved to a JSON file. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py ``` -------------------------------- ### Custom Epochs and Batch Size for MLX Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Configure the number of training epochs and the batch size for the MLX YOLOv26-seg training benchmark. This allows for customized training runs. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --epochs 5 --batch 2 ``` -------------------------------- ### MPS Training Benchmark (All Models) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Run the PyTorch MPS training benchmark for all specified models. ```bash python scripts/benchmark_yolo26_training_mps.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Tracking Demo Script: Frame-by-Frame Mode Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Run the tracking demo script in a custom frame-by-frame processing mode, allowing for detailed analysis and manipulation of each video frame. ```bash # Frame-by-frame custom processing mode python scripts/track_demo.py --model models/yolo26n.npz --source images/pedestrians.mp4 --mode framewise --show ``` -------------------------------- ### Collect and Generate Benchmark Results Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Combine all JSON results into one file and generate comparison charts. Supports PDF format for publications. ```bash # Combine all JSON results into one file python scripts/benchmark_yolo26_collect_results.py # Generate comparison charts python scripts/benchmark_yolo26_generate_charts.py # PDF format (for publications) python scripts/benchmark_yolo26_generate_charts.py --format pdf ``` -------------------------------- ### Run MLX Training Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Execute the MLX training benchmark script. You can specify models, epochs, and batch size. ```bash python scripts/benchmark_yolo26_training_mps.py python scripts/benchmark_yolo26_training_mps.py --models n s --epochs 5 --batch 2 ``` -------------------------------- ### Benchmark YOLOv26-seg Training on PyTorch CPU Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Execute training benchmarks for YOLOv26-seg models on the PyTorch CPU backend. Offers the same CLI flags as the MPS script, plus a --threads flag to control CPU thread count. This is the slowest backend, useful for baseline comparisons. ```bash python scripts/benchmark_yolo26_seg_training_cpu.py python scripts/benchmark_yolo26_seg_training_cpu.py --models n s --epochs 5 --batch 2 # Control CPU thread count python scripts/benchmark_yolo26_seg_training_cpu.py --threads 4 ``` -------------------------------- ### Run MLX Training Benchmark for All Models Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Execute the MLX training benchmark script to train YOLO26 models using the pure MLX implementation and measure performance metrics. ```bash python scripts/benchmark_yolo26_training_mlx.py ``` -------------------------------- ### Collect and Generate Tracking Benchmark Charts Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Collects tracking results into a single JSON file and then generates comparison charts for various metrics like MOTA, IDF1, and FPS. ```bash python scripts/benchmark_tracking_collect_results.py ``` ```bash python scripts/benchmark_tracking_generate_charts.py ``` -------------------------------- ### Download YOLO26 Segmentation Models Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Downloads pre-trained PyTorch (.pt) weights for various YOLO26 segmentation models. These are required before conversion to MLX format. ```bash # Use the download script (downloads both detection and segmentation models) bash scripts/download_yolo26_models.sh # Or download segmentation models manually cd models curl -L -o yolo26n-seg.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-seg.pt curl -L -o yolo26s-seg.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-seg.pt curl -L -o yolo26m-seg.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-seg.pt curl -L -o yolo26l-seg.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-seg.pt curl -L -o yolo26x-seg.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-seg.pt cd .. ``` -------------------------------- ### Generate Tracking Benchmark Charts Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Creates comparison charts from the combined JSON results. Supports custom output formats and directories. ```bash # Generate PNG charts (default) python scripts/benchmark_tracking_generate_charts.py # PDF format for publications python scripts/benchmark_tracking_generate_charts.py --format pdf # Custom output directory python scripts/benchmark_tracking_generate_charts.py --output my_charts/ ``` -------------------------------- ### Activate Environment and Run Quick COCO Validation Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Activate the project's virtual environment and run a quick COCO validation test on a subset of images. ```bash cd yolo-mlx source .venv/bin/activate python scripts/evaluate_coco_val.py --model yolo26n --data datasets/coco --subset 100 ``` -------------------------------- ### Run Full MOT17 Benchmark with Shell Script Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Execute an end-to-end benchmark for MOT17 using a shell script, which can run all models with the default ByteTrack tracker, or be configured for quick runs, specific trackers, or single models. ```bash bash scripts/run_mot17_benchmark.sh ``` ```bash bash scripts/run_mot17_benchmark.sh --quick ``` ```bash bash scripts/run_mot17_benchmark.sh --tracker botsort ``` ```bash bash scripts/run_mot17_benchmark.sh --model yolo26s ``` -------------------------------- ### Evaluate MOT17 with PyTorch MPS Comparison Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Compares YOLO-MLX performance against PyTorch MPS for all models on the MOT17 dataset. ```bash # ── MOT17 evaluation (PyTorch MPS comparison) ── python scripts/evaluate_mot17_pytorch.py --model all --device mps ``` -------------------------------- ### Track Video with YOLO-MLX (Python API) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Demonstrates how to perform object tracking on a video file using the YOLO-MLX Python API. ```python # ── Track a video (Python) ── python -c " from yolo26mlx import YOLO model = YOLO('models/yolo26n.npz') model.track('images/pedestrians.mp4', conf=0.25, save=True) " ``` -------------------------------- ### Benchmark YOLOv26-seg Training on PyTorch MPS Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Run training benchmarks for YOLOv26-seg models using the PyTorch MPS backend. Supports standard CLI flags for model selection, epochs, and batch size. Default learning rate is 0.00001. ```bash python scripts/benchmark_yolo26_seg_training_mps.py python scripts/benchmark_yolo26_seg_training_mps.py --models n s --epochs 5 --batch 2 ``` -------------------------------- ### Run PyTorch CPU Training Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Execute the PyTorch CPU training benchmark script. Supports same CLI flags as MPS script, plus --threads to control CPU thread count. ```bash python scripts/benchmark_yolo26_training_cpu.py python scripts/benchmark_yolo26_training_cpu.py --models n s --epochs 5 --batch 2 # Control CPU thread count python scripts/benchmark_yolo26_training_cpu.py --threads 4 ``` -------------------------------- ### Benchmark YOLOv26-seg Training on MLX Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Run training benchmarks for YOLOv26-seg models using the MLX backend. Supports specifying multiple models, epochs, and batch size. Default learning rate is 0.000119. ```bash # ── MLX training benchmark (all models) ── python scripts/benchmark_yolo26_seg_training_mlx.py --models n s m l x --epochs 10 --batch 4 ``` -------------------------------- ### Run MOT17 PyTorch Comparison Evaluation Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Evaluate YOLO-MLX models on the MOT17 benchmark using PyTorch with either the MPS or CPU backend. This allows for direct comparison of performance across different hardware and frameworks. ```bash python scripts/evaluate_mot17_pytorch.py --model all --device mps ``` ```bash python scripts/evaluate_mot17_pytorch.py --model all --device cpu ``` -------------------------------- ### Track Webcam Feed with YOLO-MLX (CLI) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Tracks objects in real-time from a webcam feed using the YOLO-MLX command-line interface. ```bash # ── Track webcam (CLI) ── yolo-mlx track --model models/yolo26n.npz --source 0 --show ``` -------------------------------- ### Webcam Tracking with YOLO-MLX Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Real-time video tracking directly from a webcam. Press 'q' to quit the display window. ```python # Real-time tracking from webcam (press 'q' to quit) results = model.track(0, conf=0.25, show=True) ``` -------------------------------- ### Benchmark YOLO-26 Segmentation with Custom Warmup and Runs Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Configures custom numbers for warmup and timed runs during inference benchmarking. ```bash python scripts/benchmark_yolo26_seg_inference.py --warmup 5 --runs 15 ``` -------------------------------- ### Run Specific Models with MLX Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Benchmark only specific YOLOv26-seg models (e.g., 'n' and 's') using the MLX training script. This allows for focused testing. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --models n s ``` -------------------------------- ### Evaluate MOT17 with YOLO-MLX (All Models) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Evaluates all available YOLO-MLX models against the MOT17 dataset. ```bash # ── MOT17 evaluation (all models) ── python scripts/evaluate_mot17.py --model all ``` -------------------------------- ### Run Pre-commit Hooks on All Files Source: https://github.com/thewebai/yolo-mlx/blob/main/CONTRIBUTING.md Manually triggers the pre-commit hooks to run on all files in the repository. ```bash make pre-commit-run ``` -------------------------------- ### Download Official YOLO26 PyTorch Models Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Download the official YOLO26 pretrained weights (.pt files) from Ultralytics using a provided script or manually via curl. ```bash # Use the download script bash scripts/download_yolo26_models.sh # Or download manually cd models curl -L -o yolo26n.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt curl -L -o yolo26s.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt curl -L -o yolo26m.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m.pt curl -L -o yolo26l.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l.pt curl -L -o yolo26x.pt https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x.pt cd .. ``` -------------------------------- ### Benchmark YOLOv26 Inference (Specific Models) Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Runs inference benchmarks for specific YOLOv26 models (e.g., 'n' and 's'), skipping MPS and CPU backends. ```bash python scripts/benchmark_yolo26_inference.py --models n s --skip-mps --skip-cpu ``` -------------------------------- ### Run Full MOT17 Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Executes the complete MOT17 benchmark script, likely encompassing multiple evaluation steps. ```bash # ── Full MOT17 benchmark ── bash scripts/run_mot17_benchmark.sh ``` -------------------------------- ### Run MOT17 Evaluation with BoT-SORT Tracker Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Performs MOT17 evaluation using the BoT-SORT tracker instead of the default ByteTrack. ```bash python scripts/evaluate_mot17.py --model yolo26n --tracker botsort ``` -------------------------------- ### Run Instance Segmentation with YOLO-MLX Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Loads a pretrained segmentation model and performs instance segmentation on an image, saving the annotated output. ```python from yolo26mlx import YOLO model = YOLO("models/yolo26n-seg.npz", task="segment") results = model.predict("images/bus.jpg") print(results[0]) # detection + mask summary results[0].save() # saves annotated image with mask overlays to results/ ``` -------------------------------- ### Run All Models Inference Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Execute the inference benchmark script to test all available YOLO models across all backends. ```bash python scripts/benchmark_yolo26_inference.py ``` -------------------------------- ### Benchmark YOLOv26 Inference (More Runs) Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Runs inference benchmarks for YOLOv26 models with an increased number of timed runs (20) for more stable results, skipping MPS and CPU backends. ```bash python scripts/benchmark_yolo26_inference.py --runs 20 --skip-mps --skip-cpu ``` -------------------------------- ### Run All YOLO-26 Segmentation Inference Benchmarks Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Executes inference benchmarks for all YOLO-26 segmentation models across available backends (MLX GPU, PyTorch MPS, PyTorch CPU). ```bash python scripts/benchmark_yolo26_seg_inference.py ``` -------------------------------- ### Convert PyTorch Weights to MLX Format Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRAINING_BENCHMARK.md Convert downloaded PyTorch .pt model files to MLX .npz format using the yolo-mlx converters tool. The --verify flag checks weight shape correctness. ```bash yolo-mlx converters --help yolo-mlx converters convert models/yolo26n.pt -o models/yolo26n.npz --verify ``` -------------------------------- ### Benchmark Inference with MLX Only Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Run the inference benchmark script, skipping PyTorch comparisons and focusing solely on MLX performance. ```bash python scripts/benchmark_yolo26_inference.py --skip-mps --skip-cpu ``` -------------------------------- ### CLI Tracking with Larger Input Size Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Use a larger input image size for potentially improved accuracy, especially for smaller objects. This requires a model trained for that size. ```bash # Larger input size for better accuracy yolo-mlx track --model models/yolo26l.npz --source video.mp4 --imgsz 1280 --save ``` -------------------------------- ### Download MOT17 Dataset Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md This script downloads the MOT17 dataset, which is approximately 5.5 GB in size. ```bash bash scripts/download_mot17.sh ``` -------------------------------- ### Track Video with YOLO-MLX (CLI) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Performs object tracking on a video file using the YOLO-MLX command-line interface. ```bash # ── Track a video (CLI) ── yolo-mlx track --model models/yolo26n.npz --source images/pedestrians.mp4 --save ``` -------------------------------- ### Custom Output Path for MLX Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Specify a custom output file path for the results of the MLX YOLOv26-seg training benchmark. This helps in organizing benchmark outputs. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --output my_results.json ``` -------------------------------- ### Evaluate MOT17 with YOLO-MLX (Single Model) Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Evaluates a single YOLO-MLX model against the MOT17 dataset. ```bash # ── MOT17 evaluation (MLX, single model) ── python scripts/evaluate_mot17.py --model yolo26n ``` -------------------------------- ### Basic Video Tracking with YOLO-MLX Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Perform basic video tracking on a file. The results are saved to a file. Access per-frame results including track IDs and bounding boxes. ```python from yolo26mlx import YOLO model = YOLO("models/yolo26n.npz") # Track pedestrians — saves annotated output to results/pedestrians_tracked.mp4 results = model.track("images/pedestrians.mp4", conf=0.25, save=True) # Access per-frame results for r in results: if r.boxes.is_track: print(r.boxes.id) # track IDs (persistent across frames) print(r.boxes.xyxy) # bounding boxes ``` -------------------------------- ### Activate Environment and Run Full COCO Validation Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Activate the project's virtual environment and run the full COCO validation script for all models. ```bash cd yolo-mlx source .venv/bin/activate python scripts/evaluate_coco_val.py --model all --data datasets/coco ``` -------------------------------- ### Custom Learning Rate for MLX Benchmark Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Set a specific learning rate for the MLX YOLOv26-seg training benchmark. This is useful for hyperparameter tuning. ```bash python scripts/benchmark_yolo26_seg_training_mlx.py --lr 0.0001 ``` -------------------------------- ### Run Multi-Object Tracking on Video Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Performs multi-object tracking on a video file using a YOLO-MLX model. Results are saved to a specified output file. ```python from yolo26mlx import YOLO model = YOLO("models/yolo26n.npz") # Track pedestrians — saves annotated output to results/pedestrians_tracked.mp4 results = model.track("images/pedestrians.mp4", conf=0.25, save=True) ``` -------------------------------- ### Benchmark Inference with Custom Output Path Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Specify a custom file path for saving the JSON output of the inference benchmark. ```bash python scripts/benchmark_yolo26_inference.py --output my_results.json ``` -------------------------------- ### Benchmark YOLO-26 Segmentation with Custom Output Path Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Specifies a custom file path for saving the inference benchmark results. ```bash python scripts/benchmark_yolo26_seg_inference.py --output my_results.json ``` -------------------------------- ### Collect YOLO-MLX Segmentation Benchmark Results Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Executes the script to collect benchmark results for YOLO-MLX segmentation models. Ensure the script path is correct. ```python python scripts/benchmark_yolo26_seg_collect_results.py ``` -------------------------------- ### Access Segmentation Results Source: https://github.com/thewebai/yolo-mlx/blob/main/README.md Demonstrates how to access the detected bounding boxes and segmentation masks from the YOLO-MLX prediction results. ```python boxes = results[0].boxes # Boxes object — (N, 6) [x1, y1, x2, y2, conf, cls] masks = results[0].masks # Masks object — (N, H, W) binary masks print(f"Detected {len(boxes)} objects with masks of shape {masks.data.shape}") ``` -------------------------------- ### Collect Tracking Benchmark Results Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_TRACKING.md Aggregates per-model JSON files into a single combined JSON file for analysis. Supports specifying different trackers. ```bash python scripts/benchmark_tracking_collect_results.py # Collect botsort results python scripts/benchmark_tracking_collect_results.py --tracker botsort ``` -------------------------------- ### Benchmark Inference with Specific Models Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_INFERENCE_VALIDATION.md Run the inference benchmark script for only specified YOLO models (e.g., 'n' and 's'). ```bash python scripts/benchmark_yolo26_inference.py --models n s ``` -------------------------------- ### Benchmark YOLO-26 Segmentation on MLX Only Source: https://github.com/thewebai/yolo-mlx/blob/main/GUIDE_SEGMENTATION.md Runs inference benchmarks exclusively on the MLX backend, skipping PyTorch MPS and CPU comparisons. ```bash python scripts/benchmark_yolo26_seg_inference.py --skip-mps --skip-cpu ```