aisingapore / PeekingDuck

A modular framework built to simplify Computer Vision inference workloads.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Illegal Instruction when using yolox models on Raspberry pi (arm processor)

Markos-Vasalos opened this issue · comments

I get an illegal Instruction error when i'm trying to use the code below

Please keep in mind that this is happening only when i'm using the yolox library instead of the yolo one, and only on my raspberry pi (arm processor, aarch64 architecture). In my windows pc it works normally.

Can you have a look?

The error occurs when the following line is executed
yolo_output = yolo_node.run(yolo_input)

I've configured the peekingduck in my rpi following these instructions here https://peekingduck.readthedocs.io/en/stable/getting_started/03_custom_install.html#arm64

I've added all dependencies manually and is working perfectly, instead of the yolox models. I am using python 3.9.2 in rpi.

The code is the following:

import cv2

from peekingduck.pipeline.nodes.draw import bbox
from peekingduck.pipeline.nodes.model import yolox

try:

    def detectCats(frame):
        yolo_input = {"img": frame}
        yolo_output = yolo_node.run(yolo_input)

        if len(yolo_output["bboxes"]) > 0:
            print("detected")
        else:
            print("not detected")


    yolo_node = yolox.Node(score_threshold=0.25, detect=[15])
    bbox_node = bbox.Node(show_labels=True)

    camera = cv2.VideoCapture(add rtsp link to ip camera here....)

    if __name__ == "__main__":
        while True:
            result, frame = camera.read()
            detectCats(frame)


except Exception as e:
    print("Exception occurred")
    print(e)

Hi @Markos-Vasalos , could you please try upgrading the dependencies to torch==1.10.2 and torchvision==0.11.3? I was able to run the YOLOX node successfully on a Raspberry Pi 3b+ with Python 3.9.15.

This error seems to be happening to some other versions of PyTorch libraries as well (issue). If the above versions still do not work for you, perhaps you could try to incrementally increase the version and see if there is a version that works for your hardware.

Note: You may ignore the error message from pip's dependency resolver.

If the above still do not work for you, please reply with following information so we can try to reproduce the error you're seeing:

  • Raspberry Pi's model
  • Raspberry Pi's OS
  • Python package/environment manager (if any), e.g., conda (miniconda, miniforge, anaconda), pip (venv), etc

Thank you very much. Indeed these versions were the issue. I was using torch==1.10.0 and torchvision==0.11.1. As soon as I updated them it worked flawlessly with the yolox models as well. Maybe you should update these versions here as well?

https://github.com/aisingapore/PeekingDuck/blob/main/requirements.txt

Or at least somewhere should be mentioned if different models require different versions in case someone is performing --no-dependencies with custom installation.

If no more changes should be performed in the documentation you can close the issue

Glad to hear it has resolved your issue.

We have relaxed the torch and torchvision version requirements in an upcoming release of PeekingDuck so that should allow users to choose dependency versions which work on their systems more easily.