--- base_model: - Ultralytics/YOLOv8 pipeline_tag: object-detection --- # Finetuned YOLOv8 Models with Freezing Variations on Indoor Object Detection ## Overview This repository contains a series of finetuned YOLOv8 models, exploring the effects of freezing various layers during training. The models are available in sizes ranging from Nano to Large and include three types of freezing configurations: 1. **Frozen Layers**: All layers except the classification head are frozen. 2. **Normal Training**: No layers are frozen. 3. **Frozen Backbone**: Only the backbone layers are frozen. The purpose of these configurations is to evaluate the trade-offs in performance, training time, and resource usage across different model sizes and freezing strategies. ## Usage The models are designed for object detection tasks and can be directly used with the [YOLOv8 framework](https://docs.ultralytics.com). Refer to the `README` for instructions on loading and fine-tuning these models for specific datasets. ## Dataset The models were trained on the [Indoor Object Dataset](https://paperswithcode.com/task/object-detection-in-indoor-scenes), which includes various household objects in diverse lighting and arrangement conditions. Each model was evaluated on mAP50 and mAP50-95 metrics to assess detection performance. --- ## Model Performance and Comparison Table #### Nano | Model Type | Training Time (s) | mAP50 | mAP50-95 | GPU Usage | |---------------------|-------------------|--------|----------|-----------| | Frozen Layers | 531.36 | 0.5908 | 0.4714 | 0.99GB | | Normal Training | 561.80 | 0.6312 | 0.5557 | 2.81GB | | Frozen Backbone | 537.23 | 0.6253 | 0.5407 | 1.59GB | --- #### Small | Model Type | Training Time (s) | mAP50 | mAP50-95 | GPU Usage | |---------------------|-------------------|--------|----------|-----------| | Frozen Layers | 568.25 | 0.6709 | 0.5168 | N/A | | Normal Training | 607.65 | 0.7479 | 0.6605 | N/A | | Frozen Backbone | 584.74 | 0.7477 | 0.6337 | N/A | --- #### Medium | Model Type | Training Time (s) | mAP50 | mAP50-95 | GPU Usage | |---------------------|-------------------|--------|----------|-----------| | Frozen Layers | 608.85 | 0.7367 | 0.5945 | N/A | | Normal Training | 662.55 | 0.7432 | 0.6485 | N/A | | Frozen Backbone | 633.72 | 0.7432 | 0.6537 | N/A | --- #### Large | Model Type | Training Time (s) | mAP50 | mAP50-95 | GPU Usage | |---------------------|-------------------|--------|----------|------------| | Frozen Layers | 648.41 | 0.7435 | 0.6092 | 3.92GB | | Normal Training | 706.58 | 0.7357 | 0.6375 | 14.8GB | | Frozen Backbone | 680.45 | 0.7416 | 0.6650 | 7.5GB | --- ## Key Observations - **Nano Model**: Freezing the backbone provides a good trade-off in GPU usage and mAP50 performance compared to normal training. - **Small Model**: Normal training outperforms both freezing configurations but at the cost of higher training time. - **Medium Model**: The frozen backbone configuration offers nearly identical performance to normal training, with slightly reduced training time. - **Large Model**: The frozen backbone approach achieves the highest mAP50-95 among all configurations while using significantly less GPU memory than normal training. --- ## How to Use the Models 1. Clone the repository. 2. Install the ultralytics library (pip install ultralytics) 3. Load the model size and freezing configuration of your choice. ```python from ultralytics import YOLO # Load a finetuned YOLOv8 model model = YOLO('path-to-model.pt') # Perform inference results = model('path-to-image.jpg') results.show() ``` --- If your goal is to use it in matlab, you need to: 1. Clone the repository. 2. Clone the [Matlab YOLOv8](https://github.com/matlab-deep-learning/Pretrained-YOLOv8-Network-For-Object-Detection) repository. 3. Use the [convert_to_onnx.py](https://huggingface.co/pauhidalgoo/yolov8-indoor/blob/main/convert_to_onnx.py) 4. Load the model in Matalb like shown in [3_YOLO_matlab.mlx](https://huggingface.co/pauhidalgoo/yolov8-indoor/blob/main/3_YOLO_matlab.mlx)