--- title: HRSID Ship Detection Demo emoji: 🚢 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: 4.44.0 app_file: app.py pinned: false license: apache-2.0 tags: - code - deeplearning - torch - objectDetection/segmentation --- # 🚢 HRSID Ship Detection Demo This Gradio Space demonstrates a Faster R-CNN model trained on HRSID dataset for ship detection in SAR imagery. Upload a SAR image to detect ships. --- license: apache-2.0 tags: - object-detection - synthetic-aperture-radar - detectron2 - faster-rcnn - ship-detection datasets: - HRSID metrics: - mAP --- # 🚢 Ship Detection in SAR Imagery using Faster R-CNN (HRSID) ## Abstract Synthetic Aperture Radar (SAR) imagery enables all-weather, day-and-night maritime monitoring. However, ship detection in SAR images is challenging due to speckle noise, varying vessel scales, and complex coastal backgrounds. This work presents a **Faster R-CNN (ResNet-50 FPN)** based object detection model trained on the **HRSID dataset** for robust ship detection in high-resolution SAR imagery. --- ## 📷 Qualitative Results ### Detection Output ![Output](./im.png) The model successfully detects ships of varying scales in cluttered maritime environments. --- ## 🧠 Model Architecture - **Framework:** Detectron2 - **Detector:** Faster R-CNN - **Backbone:** ResNet-50 + Feature Pyramid Network (FPN) - **Classes:** 1 (Ship) - **Inference Device:** CPU compatible --- ## 📊 Training Configuration | Parameter | Value | |-----------|--------| | Dataset | HRSID | | Image Resolution | 1400 × 1400 | | Iterations | {MAX_ITER} | | Score Threshold | {SCORE_THRESH} | | Optimizer | SGD | | Learning Rate | 0.0025 | --- ## 📈 Evaluation | Metric | Value | |--------|--------| | mAP@0.5 | (Add your value) | | Precision | (Add value) | | Recall | (Add value) | > Note: Metrics computed on validation split of HRSID dataset. --- ## 🛰 Dataset Description HRSID (High-Resolution SAR Images Dataset) contains: - 5000+ SAR images - Thousands of annotated ship bounding boxes - Multi-scale vessel distribution - Coastal and open-sea scenarios --- ## ⚙ Inference Code ```python from detectron2.config import get_cfg from detectron2.engine import DefaultPredictor import cv2 cfg = get_cfg() cfg.merge_from_file("config.yaml") cfg.MODEL.WEIGHTS = "model_final.pth" cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 predictor = DefaultPredictor(cfg) image = cv2.imread("test_sar.jpg") outputs = predictor(image) print(outputs)