# Detection zone moodel learning

**URL:** <https://forums.openmv.io/t/detection-zone-moodel-learning/11652>\
**Category:** OpenMV Boards\
**Created:** [May 14, 2026, 5:24pm UTC](https://forums.openmv.io/t/detection-zone-moodel-learning/11652 "2026-05-14T17:24:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsw\_010](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@lsw\_010](https://forums.openmv.io/u/lsw_010)\
**Post date:** [May 14, 2026, 5:24pm UTC](https://forums.openmv.io/t/detection-zone-moodel-learning/11652/1 "2026-05-14T17:24:06Z")

</div>

Hi everyone,

I made a model in roboflow (Roboflow 3.0 model) to detect yellow goals, blue goals, and black walls, but when I tried to use the model with my phone the whole screen could detect the goals and walls. But when I put the model on my openMV N6 camera it only detected the goals and walls in a 400x400 square in the middle, I thought I fixed it by resizing the format in the pre-processing step to 640x480 and then making a new version of the model with the different format, but that didn’t do anything.

 ![Screenshot 2026-05-14 180947](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/5/5669ec43ca5d46ac104ba8dae57241bf17342e9d.jpeg)

Here is my OpenMV code:

```auto
import csi
import time
import math
import ml
from ml.postprocessing.ultralytics import YoloV8
from machine import UART
import ustruct

# Initialize the sensor.
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.VGA)
csi0.window((640, 480)) #((0, 170, 640, 200))

# Initialize bus, baudrate
uart = UART(3, 115200)

clock = time.clock()

# Load YOLO V8 model.
model = ml.Model("/rom/openmv_goal-and-wall-detection_v3.bin",

    postprocess=YoloV8(threshold=0.4)
)

model.labels = ["Black wall", "blue-goal", "yellow-goal"]

# Colors
n = len(model.labels)
model_class_colors = [
    (int(255 * i // n), int(255 * (n - i - 1) // n), 255)
    for i in range(n)
]

while True:
    clock.tick()
    img = csi0.snapshot()

    boxes = model.predict([img])

    for i, class_detections in enumerate(boxes):
        rects = [r for r, score in class_detections]
        labels = [model.labels[i] for j in range(len(rects))]
        colors = [model_class_colors[i] for j in range(len(rects))]

        ml.utils.draw_predictions(img, rects, labels, colors, format=None)

        for (x, y, w, h), score in class_detections:
            center_x = math.floor(x + (w / 2))
            center_y = math.floor(y + (h / 2))

            rel_x = center_x - 320
            rel_y = 240 - center_y
            label = model.labels[i]

            # Draw red line (this is your “tangent visualization”)

            if label == "blue-goal" or label == "yellow-goal":
                img.draw_line((320, 240, center_x, center_y), color=(255, 0, 0), thickness=2)

            img.draw_circle((center_x, center_y, 5), color=(255, 255, 255))

```

Does anyone have an idea to make the camera detect goals and walls in the whole screen, instead of just the square in the middle?

Thank you very much!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 14, 2026, 5:52pm UTC](https://forums.openmv.io/t/detection-zone-moodel-learning/11652/2 "2026-05-14T17:52:58Z")

</div>

Hi, with the latest dev release firmware just remove

```auto
csi0.window((640, 480)) #((0, 170, 640, 200))

```

E.g. See [openmv/scripts/examples/03-Machine-Learning/00-TensorFlow/yolo\_v8\_detector.py at master · openmv/openmv · GitHub](https://github.com/openmv/openmv/blob/master/scripts/examples/03-Machine-Learning/00-TensorFlow/yolo_v8_detector.py)

---

<div class="post-metadata">

**Author:** ![lsw\_010](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@lsw\_010](https://forums.openmv.io/u/lsw_010)\
**Post date:** [May 15, 2026, 8:26am UTC](https://forums.openmv.io/t/detection-zone-moodel-learning/11652/3 "2026-05-15T08:26:08Z")

</div>

Hi,

Thank you for answering so fast!

I downloaded the latest firmware (4.8.10) and removed the line of code, but it still only detected the middle square. I also tried the example code with our camera, but still, only the middle square.

Do you have any idea what the problem could be?

Thanks!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 15, 2026, 5:39pm UTC](https://forums.openmv.io/t/detection-zone-moodel-learning/11652/4 "2026-05-15T17:39:45Z")

</div>

Hi, it’s because you are using the non-v5.0.0 firmware which forces the center to be a square.

Please install the latest IDE from here: [Release Development Release · openmv/openmv-ide · GitHub](https://github.com/openmv/openmv-ide/releases/tag/development)

Any non factory IDE version. Then, click the Tools-\>Install the Latest Development firmware to get the pre-release v5.0.0 firmware. The examples have change around since v4.8.1 so you will need to pull them from here: [openmv/scripts/examples at master · openmv/openmv · GitHub](https://github.com/openmv/openmv/tree/master/scripts/examples)

I will have another release of the IDE next week that resolves the versioning issues and has the examples in sync with the firmware.
