# \[Deep Vision Library\] How can I use my own YOLO-v5?

**URL:** https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481
**Category:** Libraries
**Created:** [May 24, 2024, 7:44am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481 "2024-05-24T07:44:56Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 24, 2024, 7:44am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481/1 "2024-05-24T07:44:56Z")

</div>

[Deep Vision Library] How can I use my own YOLO-v5?

@cansik

hello. Nice to meet you.

- Library (url): [GitHub - cansik/deep-vision-processing: Deep computer-vision algorithms for the Processing framework.](https://github.com/cansik/deep-vision-processing)
- Source code (url): [deep-vision-processing/src/main/java/ch/bildspur/vision/YOLONetwork.java at master · cansik/deep-vision-processing · GitHub](https://github.com/cansik/deep-vision-processing/blob/master/src/main/java/ch/bildspur/vision/YOLONetwork.java)

> yolo = new YOLONetwork(model, weights, 256, 256);  
> yolo.setLabels(LABEL);  
> yolo.setup();

1. In case of ‘yolo-v4’

- Match the ‘cfg file’ to the ‘model’ location.
- Match the ‘weights file’ to the ‘weights’ location.
- It works well.

1. In case of ‘yolo-v5’

- Which file should be matched to the ‘model’ location?
- Can I match only one of ‘yolov5l.yaml’ or ‘yolov5m.yaml’ or ‘yolov5s.yaml’ in the ‘weights’ position?

I’m asking because I don’t know how to use it.  
help.

---

<div class="post-metadata">

### Author: ![cansik](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/cansik/32/8815_2.png) [@cansik](https://discourse.processing.org/u/cansik)
#### Post date: [May 24, 2024, 8:45am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481/2 "2024-05-24T08:45:43Z")

</div>

For YoloV5 the ONNX models are used. As you can see [DeepVision.java](https://github.com/cansik/deep-vision-processing/blob/master/src/main/java/ch/bildspur/vision/DeepVision.java#L198-L206), the model is set to `null` and the weights are for example [yolov5s.onnx](https://github.com/cansik/deep-vision-processing/releases/download/repository/yolov5s.onnx).

```processing
YOLONetwork network = new YOLONetwork(
        null,
        "my-model.onnx",
        640, 640,
        true
);

network.loadLabels(names.getPath());
network.setTopK(100);

```

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 25, 2024, 12:15am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481/3 "2024-05-25T00:15:09Z")

</div>

@cansik

Thank you.!!!

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 25, 2024, 12:45am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481/4 "2024-05-25T00:45:07Z")

</div>

@cansik

Thank you for quick response. I have more questions, so I’m leaving an answer.

1. Is only the extension ‘.onnx’ possible?

2. If you add the ‘.onnx’ file in the url,

1. The program runs without error, but
2. Cannot detect smoke or fire.  
[YoloFireAndSmoke/demo/ONNXRuntime at main · Pratham-taneja/YoloFireAndSmoke · GitHub](https://github.com/Pratham-taneja/YoloFireAndSmoke/tree/main/demo/ONNXRuntime)

Is there a reason?

---

<div class="post-metadata">

### Author: ![cansik](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/cansik/32/8815_2.png) [@cansik](https://discourse.processing.org/u/cansik)
#### Post date: [May 25, 2024, 11:06am UTC](https://discourse.processing.org/t/deep-vision-library-how-can-i-use-my-own-yolo-v5/44481/5 "2024-05-25T11:06:07Z")

</div>

I guess it‘s because you are trying to run a [YoloX](https://arxiv.org/abs/2107.08430) model with the [Yolov5](https://github.com/ultralytics/yolov5) implementation. I don‘t think it will work just out of the box, since pre- and postprocessing are different.
