https://drive.google.com/file/d/19oFZnLerR7BqzS7DQgBRUjD6ly3CpQe3/view?usp=sharing
This repository contains the complete pipeline for an edge-deployable computer vision model designed to analyze images and detect insulator defects. The model is trained to be lightweight and optimized, ensuring it runs efficiently on edge devices like the Nvidia Jetson Nano.
- Dataset
- Tech Stack
- System Architecture
- Repository Structure
- Execution Workflow & Environments
- Quantitative Results
- Visual Results
- How to Run Inference
- Contributors
- License
- Programming Language: Python
- Deep Learning Frameworks: PyTorch, YOLOv8
- Inference & Optimization: ONNX Runtime, TensorRT
- Computer Vision: OpenCV
- Web App UI: Streamlit
- Edge Hardware: NVIDIA Jetson Nano
- Training Environments: Kaggle, Google Colab
The pipeline follows a robust teacher-student knowledge distillation approach, combined with structural pruning and ONNX conversion to guarantee real-time performance on edge devices.
graph TD
A[IDID Dataset] -->|Train| B[Teacher Model<br>YOLOv8m]
B -->|Knowledge Distillation| C[Student Model<br>YOLOv8n]
C -->|Structural Pruning| D[Pruned Student Model]
D -->|Export| E[ONNX Format]
E -->|Deploy| F[Edge Inference<br>Nvidia Jetson Nano]
style A fill:#f9f,stroke:#333,stroke-width:2px
style F fill:#bbf,stroke:#333,stroke-width:2px
link : https://www.kaggle.com/competitions/insulator-defect-detection/data
The model was trained and evaluated on the Insulator Defect Detection Dataset (IDID) and open source Internet Image. The dataset consists of images categorized into three main classes:
0: good1: broken2: flashover
├── data/
│ └── sample_images/ # Sample images for testing the model
├── deployment/ # Edge deployment scripts (Jetson Nano/Local PC)
│ ├── app.py # Streamlit web UI for defect diagnosis
│ ├── optimized_model.onnx # Final optimized ONNX model
│ ├── batch_inference.py # Batch image inference script
│ └── webcam_inference.py # Real-time webcam inference script
├── docs/ # Project reports and presentations
├── models/ # PyTorch model weights (.pt)
│ ├── pruned_model.pt # Pruned YOLOv8 model
│ ├── student_model.pt # Distilled YOLOv8 student model
│ └── teacher_model.pt # Heavy baseline YOLOv8 teacher model
├── training/ # Jupyter Notebooks for the training pipeline
│ ├── preprocessing_teacher.ipynb
│ ├── student_training.ipynb
│ ├── pruning.ipynb
│ └── onnx_conversion.ipynb
├── requirements.txt # Project dependencies
└── README.md # Project documentation
The development of this project was split across cloud GPUs (for training) and Edge Devices (for inference).
All .ipynb files in the training/ folder were executed on cloud platforms (Kaggle/Google Colab) to leverage powerful GPUs. The workflow is strictly sequential:
preprocessing_teacher.ipynb: Preprocesses the IDID dataset and trains the heavy baseline teacher model (teacher_model.pt).student_training.ipynb: Applies Knowledge Distillation to transfer knowledge from the heavy teacher to a lightweight student model (student_model.pt).pruning.ipynb: Structurally prunes the student model to reduce its parameter count and physical size while maintaining accuracy (pruned_model.pt).onnx_conversion.ipynb: Converts the final optimized PyTorch model to the ONNX format (optimized_model.onnx) for high-speed inference on edge devices.
Once the optimized_model.onnx model was generated, it was transferred to the Nvidia Jetson Nano for real-time edge deployment.
Before running the deployment scripts on the Jetson Nano, ensure your device is flashed with the appropriate NVIDIA JetPack SDK.
Note: The
deployment/folder includes anonnxruntime_gpu-1.11.0-cp38-cp38-linux_aarch64.whlfile, which is specifically required for enabling hardware-accelerated ONNX inference on the Jetson's ARM64 architecture.
| Model | Size | mAP50 | mAP50-95 | Device |
|---|---|---|---|---|
| YOLOv8m Teacher | 49.6 MB | 0.985 | 0.904 | GPU Kaggle T4 |
| YOLOv8n Student | 6.0 MB | 0.986 | 0.860 | GPU Kaggle T4 |
| Pruned Model | 4.8 MB | 0.943 | 0.779 | Kaggle GPU T4 |
| ONNX Model | 9.4 MB | ~0.943 | ~0.779 | Jetson Nano |
| Input Image | Jetson Nano Output |
|---|---|
![]() |
![]() |
You can run the deployment scripts on a Jetson Nano or your Local PC (using CPU/GPU).
For Local PC / Cloud Environment:
pip install -r requirements.txtFor NVIDIA Jetson Nano:
# 1. Install ONNX Runtime using the provided wheel for ARM64
pip install deployment/onnxruntime_gpu-1.11.0-cp38-cp38-linux_aarch64.whl
# 2. Install the lightweight Jetson dependencies
pip install -r requirements_jetson.txtNote: We recommend using the JetPack pre-installed
cv2(OpenCV) to ensure hardware acceleration is retained on the Jetson Nano.
cd deployment
source venv/bin/activate # Or your appropriate virtual environment activation command-
Batch Image Processing (Processes images from
data/sample_images/):python batch_inference.py
-
Real-Time Webcam Processing:
python webcam_inference.py
-
Interactive Web UI (Streamlit):
streamlit run app.py
Note: When you are done, you can exit the virtual environment by running
deactivate.
Processed output images and logs will automatically be saved to the deployment/output/ directory.
Batch No. 9
- Gaurav Chhajed (522261) - GauravChhajed
- Jay Kishan (522136) - Jaysah02
- Abhishek Singh (522101) - singhabhi137
Supervisor:
GitHub Repository: Edge_deployable_DeepLearning_Model_for_Image_Analysis
This project is licensed under the MIT License.


