Skip to content

Custom object detection implementation #45

@Kasi21

Description

@Kasi21
  • rpi-deep-pantilt version: 1.2.1
  • Python version: 3.7
  • TensorFlow version: 2.2.0
  • Operating System: Windows

Description

I am trying to implement a custom object detector trained for leopard and exported from Google Cloud AutoML (cloud.google.com/vision/automl/object-detection/docs/export-edge). I can't get this to work. I've followed through on the advice given in #40, but I'm not having any luck. Specifically:

  • I cloned and edited the SSDMobileNet_V3_Coco_EdgeTPU_Quant class in a new leopardtflite.py file, which also has the code for the imports needed and has the labels changed. In this file, I also point model.path to wherever the leopard tflite file is saved.

  • I created a new object detection pbtxt file

  • I edited cli.py to import the leopard tf lite models and run the models when the 'leopard' label is specified.

What I Did

Here's what happens when I run the code

(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt track leopard  --rotation=180
Process Process-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/camera.py", line 30, in run_pantilt_detect
    model = model_cls()
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/leopardtflite.py", line 51, in __init__
    self.model.path = '/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/leopard.tflite'
AttributeError: 'leopardtfliteModel' object has no attribute 'model'
^C[INFO] You pressed `ctrl + c`! Exiting...
[INFO] You pressed `ctrl + c`! Exiting...
[INFO] You pressed `ctrl + c`! Exiting...

Aborted!

Any guidance you can provide on custom model implementation would be super appreciated. 🙏 I've also attached the cli file and leopardtflite.py file for reference.

leopardDetection.zip

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions