Skip to content

Simple camera preview processed with Yolo model

License

Notifications You must be signed in to change notification settings

Tonto5000/yolo3-camera

Repository files navigation

yolo-camera

Encapsulates existing YOLO-based backend codebase to use YOLO model on USB camera or Raspberry Pi camera input.

Credits

Get the code

$ git clone --recursive https://github.com/ctchuang/yolo3-camera.git

Do not forget --resursive option.

Pick a backend

1. Keras_Yolo3

  • Backend: Keras + Tensorflow
  • Platform:
    • Mac OS X
    • Ubuntu Linux
    • Remark:
      • Running on Raspbian hits Bus Error in TensorFlow. I didn't debug it.
  • AI Model: yolov3-tiny
  • AI Hardware:
    • Pure CPU
    • GPU (haven't tested)
  • Setup keras_yolo3 backend

2. YoloV2NCS

  • Backend: Intel Movidius SDK
  • Platform:
    • Ubuntu Linux
    • Raspbian (Raspberry Pi 3)
    • Remark:
      • Movidius NCS SDK doesn't support Mac OS.
  • AI Model: yolov2-tiny-voc
  • AI Hardware:
    • Intel Movidius NCS USB stick.
  • Setup YoloV2NCS backend

Run it

Attach a USB camera or Raspberry Pi Camera.

# Use Keras backend
$ python3 run.py -b 0 [-c camera_id]

# Use YoloV2NCS
$ python3 run.py -b 1 [-c camera_id]

# Get help
$ python3 run.py -h

You should see live yolo result like below: Example

It also works on Raspberry Pi 3 with Pi camera. RPi3

Press ESC key to exit.

camera id

For USB camera:

$ ls -l /dev/video*

For example, use 1 as camera id for /dev/video1.

For Raspberry Pi camera, use pi as camera id.

Troubleshooting

Test camera is working

$ python3 test_camera.py -c [camera_id]

Movidius NCS on Raspberry Pi 3

When using USB camera + Movidius NCS on Raspberry Pi 3 Model B may have flakiness because RPi 3 Model B does not get enough DC power input. Adding a powered USB 3.0 hub can fix this.

RPi3 Model B+ can get more DC power input, and it's possible to use USB camera and Movidius NCS stick without extra AC-powered USB hub.

Other Known Issues

  • Reading from Raspberry Pi camera to OpenCV is very slow. (<2FPS)

About

Simple camera preview processed with Yolo model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published