# To modify YOLOv8

**URL:** <https://community.ultralytics.com/t/to-modify-yolov8/1113>\
**Category:** Discussion\
**Tags:** question\
**Created:** [June 1, 2025, 3:32pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113 "2025-06-01T15:32:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MohitCoventry\_Univer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/mohitcoventry_univer/32/758_2.png) [@MohitCoventry\_Univer](https://community.ultralytics.com/u/MohitCoventry_Univer)\
**Post date:** [June 1, 2025, 3:32pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/1 "2025-06-01T15:32:12Z")

</div>

I’m modifying YOLOv8 for pedestrian detection by:

1. Adding **CBAM** after each C2f in the backbone
2. Replacing **FPN with BiFPN**
3. Using a **smaller detection head**

Keep getting errors while integrating—is this possible? Need help fixing it.

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [June 2, 2025, 11:42am UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/2 "2025-06-02T11:42:29Z")

</div>

Have you tested the default YOLOv8 or YOLO11 model (no modifications) with your data? The COCO trained models do a very good job at detecting the `person` class without the need for architecture modification. There are lots of ways that modifying the model structure can go wrong and unless there’s an established need for it, generally I would not recommend attempting it.

---

<div class="post-metadata">

**Author:** ![MohitCoventry\_Univer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/mohitcoventry_univer/32/758_2.png) [@MohitCoventry\_Univer](https://community.ultralytics.com/u/MohitCoventry_Univer)\
**Post date:** [June 2, 2025, 3:51pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/3 "2025-06-02T15:51:21Z")

</div>

yes I have tried, but by reading some research papers on YOLO modification i developed my interest and chosen this as my MTech project but now i got stuck.

If not introducing new module can you suggest me some easy modification or may be reduction in my scope which is doable and will be good for small objects

---

<div class="post-metadata">

**Author:** ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)\
**Post date:** [June 3, 2025, 12:14pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/4 "2025-06-03T12:14:37Z")

</div>

I know lots of people have developed an interest to try modifying the YOLO architecture, and if your goal is to learn, then it is something that I encourage all to try! Trying to modify the model structure is not a simple task however and a lot of how to do it, and how to do it well, will come down to testing for your specific use case. That means that it’s unlikely anyone will be able to tell you “do this” to get a good result for your use, you will probably have to test lots of modifications to find what works best.  
If you’d still like to try implementing the `CBAM` module, then I recommend reviewing the related [GitHub issues](https://github.com/ultralytics/ultralytics/issues?q=is%3Aissue%20%22CBAM%22), as there are many. You might be able to find someone who has outlined their solution that could also work for you to test with, but keep in mind that it only _might_ help.

Since you’re looking to improve the performance for detection of smaller objects, here are a few things you can try:

1. Increase the inference image size using the `imgsz` [argument](https://docs.ultralytics.com/modes/predict/#inference-arguments).
2. Try using the `yolov8l-p2` or `yolov8x-p2` [model configurations](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/models/v8/yolov8-p6.yaml) (there are no pretrained versions however).
3. Try using [tiled-inference with SAHI](https://docs.ultralytics.com/guides/sahi-tiled-inference/)
4. Review the many [GitHub issues](https://github.com/ultralytics/ultralytics/issues?q=is%3Aissue%20%22small%20objects%22) where people have asked about the same.

---

<div class="post-metadata">

**Author:** ![MohitCoventry\_Univer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/mohitcoventry_univer/32/758_2.png) [@MohitCoventry\_Univer](https://community.ultralytics.com/u/MohitCoventry_Univer)\
**Post date:** [June 3, 2025, 3:44pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/5 "2025-06-03T15:44:30Z")

</div>

thanks for your suggestions.

---

<div class="post-metadata">

**Author:** ![pderrenger](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/pderrenger/32/73_2.png) [@pderrenger](https://community.ultralytics.com/u/pderrenger)\
**Post date:** [June 4, 2025, 1:29pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/6 "2025-06-04T13:29:32Z")

</div>

Thanks for the update. Modifying core architectural components like the neck by replacing FPN with BiFPN or adding attention modules like CBAM after each C2f block in the backbone can indeed be quite complex and prone to integration errors.

For your MTech project focusing on improving pedestrian detection, especially for small objects, you might find it more manageable and still impactful to explore adjustments that leverage the existing strengths of YOLOv8. Consider training with larger input image sizes; increasing `imgsz` often significantly helps in resolving smaller details. You can find more about training parameters in our [Train mode documentation](https://docs.ultralytics.com/modes/train/). Tailoring your data augmentation strategies to better preserve or even emphasize small objects during training can also be beneficial. You could also experiment with starting from a larger pretrained YOLOv8 model, such as YOLOv8m or YOLOv8l, which might provide a richer feature set. Finally, thorough hyperparameter tuning is always a valuable step.

These approaches can often yield good improvements for small object detection with a more contained scope of work. Good luck with your project!

---

<div class="post-metadata">

**Author:** ![MohitCoventry\_Univer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/mohitcoventry_univer/32/758_2.png) [@MohitCoventry\_Univer](https://community.ultralytics.com/u/MohitCoventry_Univer)\
**Post date:** [June 4, 2025, 5:40pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/7 "2025-06-04T17:40:29Z")

</div>

thank you pderrenger, for your suggestions.

---

<div class="post-metadata">

**Author:** ![pderrenger](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/pderrenger/32/73_2.png) [@pderrenger](https://community.ultralytics.com/u/pderrenger)\
**Post date:** [June 5, 2025, 1:28pm UTC](https://community.ultralytics.com/t/to-modify-yolov8/1113/8 "2025-06-05T13:28:41Z")

</div>

You’re most welcome, Mohit! I’m glad the suggestions were helpful. Best of luck with your MTech project and your work on modifying YOLOv8!
