--- license: apache-2.0 tags: - object-detection - yolo - yolov8 - yolov8m - ultralytics - defence - pytorch - computer-vision - tracking - instance-segmentation - image-classification - pose-estimation - obb language: - en library_name: ultralytics pipeline_tag: object-detection datasets: - private metrics: - mAP model-index: - name: YOLOv8m Defence results: - task: type: object-detection name: Object Detection metrics: - type: mAP@0.5:0.95 value: 0.598 name: Mean Average Precision base_model: - Ultralytics/YOLOv8 --- # YOLOv8m Defence ## Model Overview YOLOv8m Defence is a specialized object detection model fine-tuned from the `ultralytics/YOLOv8` checkpoint for defence and transportation applications. The model was trained for over 50 epochs on a private defence-related dataset to detect 18 categories of aircraft, vehicles, and ships with high accuracy and low latency requirements. A deployment of the model is available at [Hugging Face Spaces](https://huggingface.co/spaces/spencercdz/YOLOv8m_defence) for demonstration of its capabilities. ## Model Details - **Model Type**: Object Detection - **Base Architecture**: YOLOv8m - **Framework**: PyTorch - **Training Epochs**: 50+ - **Number of Classes**: 18 - **Input**: RGB Images - **Output**: Bounding boxes with class predictions and confidence scores ## Supported Classes The model detects the following 18 object categories: | Class ID | Object Type | |----------|-------------| | 0 | Cargo Aircraft | | 1 | Commercial Aircraft | | 2 | Drone | | 3 | Fighter Jet | | 4 | Fighter Plane | | 5 | Helicopter | | 6 | Light Aircraft | | 7 | Missile | | 8 | Truck | | 9 | Car | | 10 | Tank | | 11 | Bus | | 12 | Van | | 13 | Cargo Ship | | 14 | Yacht | | 15 | Cruise Ship | | 16 | Warship | | 17 | Sailboat | ## Performance The model achieved the following performance metrics in its original evaluation environment: - **mAP@0.5:0.05:0.95**: 0.598 - **Speed Score**: 0.933 *Note: These scores were achieved with the fully optimized TensorRT version. The PyTorch model provided here may have different performance characteristics.* ## Usage ### Installation ```bash pip install ultralytics ``` ### Quick Start ```python from ultralytics import YOLO from PIL import Image # Load the model model = YOLO('path/to/yolov8m_defence.pt') # Run inference results = model('path/to/your/image.jpg') # Process results for r in results: print(f"Detected {len(r.boxes)} objects") for box in r.boxes: # Get bounding box coordinates x1, y1, x2, y2 = box.xyxy[0] bbox = [int(x1), int(y1), int(x2 - x1), int(y2 - y1)] # Get class and confidence class_id = int(box.cls[0]) confidence = float(box.conf[0]) class_name = model.names[class_id] print(f" {class_name} (ID: {class_id}): {confidence:.2f} at {bbox}") ``` ### Batch Inference ```python # Run inference on multiple images results = model(['image1.jpg', 'image2.jpg', 'image3.jpg']) for i, r in enumerate(results): print(f"Image {i+1}: {len(r.boxes)} detections") ``` ### Visualization ```python # Display results with bounding boxes results = model('image.jpg') annotated_image = results[0].plot() # Convert BGR to RGB for display from PIL import Image import numpy as np Image.fromarray(annotated_image[..., ::-1]).show() ``` ## Training Details ### Dataset - **Source**: Private defence dataset (proprietary) - **Classes**: 18 object categories - **Augmentations**: Mosaic, flips, color adjustments - **Annotations**: Bounding box format ### Training Configuration - **Base Model**: ultralytics/yolov8m - **Training Epochs**: 50+ - **Framework**: Ultralytics YOLO - **Optimization**: Standard YOLOv8 training pipeline ### Post-Training Optimization The original model underwent additional optimization including: - Model pruning - Quantization - TensorRT conversion (for deployment) *This repository contains the pre-optimization PyTorch model for maximum compatibility and ease of use.* ## Intended Use Cases ### Primary Applications - Military and defence object detection - Transportation vehicle monitoring - Surveillance and reconnaissance - Aerial and maritime asset identification ### Suitable For - Direct inference on defence-related imagery - Transfer learning for similar detection tasks - Baseline model for military/civilian vehicle detection - Research and development in computer vision ## Limitations - **Scope**: Only detects the 18 trained object categories - **Domain**: Performance may vary on images significantly different from training data - **Speed**: This PyTorch version is slower than the optimized TensorRT variant - **Hardware**: No specific GPU requirements, but GPU acceleration recommended ## Ethical Considerations This model is designed for defence and security applications. Users should: - Ensure compliance with local laws and regulations - Consider privacy implications when processing imagery - Use responsibly and ethically in surveillance applications - Respect international laws regarding military technology ## Citation ```bibtex @misc{yolov8_ultralytics, author = {Jocher, Glenn and Chaurasia, Ayush and Qiu, Jing}, title = {YOLO by Ultralytics}, year = {2023}, howpublished = {\url{https://github.com/ultralytics/ultralytics}}, } ``` ## License This model is released under the Apache 2.0 License. ## Model Card Contact For questions about this model card or the model itself, please refer to the repository issues or contact the model authors.