OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.58k stars 2.19k forks source link

Segmentation fault #120

Closed Devraj004 closed 5 years ago

Devraj004 commented 5 years ago

Hi Ola, I am trying to run object detection on my raspberry pi and getting the "Segmentation fault" error while the same script is running fine on my laptop. any help please ?

Using TensorFlow backend. Segmentation fault

Here is the script.

from imageai.Detection import VideoObjectDetection import os import cv2

execution_path = os.getcwd() camera = cv2.VideoCapture(0)

def forFrame(frame_number, output_array, output_count): print("FOR FRAME " , frame_number) print("Output for each object : ", output_array) print("Output count for unique objects : ", output_count) print("------------END OF A FRAME --------------")

video_detector = VideoObjectDetection() video_detector.setModelTypeAsYOLOv3() video_detector.setModelPath(os.path.join(execution_path, "yolo.h5")) video_detector.loadModel()

video_detector.detectObjectsFromVideo(camera_input=camera, frames_per_second=20, per_frame_function=forFrame, minimum_percentage_probability=30, save_detected_video=False)

OlafenwaMoses commented 5 years ago

Please uninstall and re-install the ImageAI and it's dependencies on the Raspberry Pi. You can also follow the link below for more clarity on this.

https://stackoverflow.com/questions/31222975/python-command-segmentation-fault-on-raspberry-pi

Devraj004 commented 5 years ago

I tested the code line by line and identified the issue with tensorflow library when running in python virtual environment. So we can close this case for now.

Thank you John and Moses. I have read your book and found very useful. I am really grateful for you both to share such an excellent deep learning and Computer vision book with us.

Many thanks Devraj