I’m working on a robotics project with a jetson nano for a few months. I have created a Python 3 code able to take an image that it stores on a USB key and make Yolo v3 analyze it and detect the object it has been trained to detect.
The problem is that most of the time the program gives me an error like this:
segmentation fault (core dumped).
My program is attached.
What could cause the problem?
import cv2
import numpy as np
import sys, os
sys.path.append(os.path.join(os.getcwd(),'/home/kleanrov/Desktop/Kleenbot/code qui marche/finals
codes/algo_yogurtpot/original/darknet/python/'))
import darknet as dn
import pdb
#chargement algo_yogurtpot
dn.set_gpu(0)
net = dn.load_net(b"yogurt_bin_algo/yolov3-tiny-sacha.cfg",b"yogurt_bin_algo/yolov3-tiny-
sacha_best.weights", 0)
meta = dn.load_meta(b"yogurt_bin_algo/sacha.data")
def detection_ramassage_obj():
cap = cv2.VideoCapture(gstreamer_pipeline(), cv2.CAP_GSTREAMER)
img = cv2.imwrite("/media/kleanrov/cleusb1/pict1.jpg", cap)
res = dn.detect(net, meta, img)
#res = dn.detect_img(net, meta, img)
#print(res)
cap.release()
if res == []:
print("nothing detected")
else:
print("object detected: ")
for detection in res:
name = detection[0]
proba = detection[1]
box = detection[2]
centre_x = box[0]
centre_y = box[1]
largeur = box[2]
hauteur = box[3]
print("nom:%s, proba:%s%%, position:%s"%(name, proba*100, box))
if name == b'petit suisse':
print("yogurt pot")
GPIO.cleanup()
import module_rapprochement_final_301220
detection_ramassage_obj()