In this repository you can find some examples on how to use the Tensorflow OD API with Tensorflow 2. Referenced from Tensorflow Object Detection with Tensorflow 2 (Gilbert Tanner)
This TF2 OD example code was used for the demo in my talk, UP ACM Fest 2021 "AI Hackathon: Building Your First Prototype"
Accompanying slides can be found here: Google Slides Link
Recorded video can be viewed here (13:55 mark) Building AI Prototypes Workshop
- Creating python virtual env
$ python3 -m venv ~/venvs/[name_of_env]
e.g.
$ python3 -m venv ~/venvs/tf-od- Activating python virtual env
$ source ~/venvs/[name_of_env]/bin/activate
e.g.
$ source ~/venvs/tf-od/bin/activate- Install the project's requirements
$ pip3 install -r requirements.txt-
Choose one of the models and download
-
Extract the downloaded model
**For the example output, efficientdet_d2_coco17_tpu-32 was used
-
Upload your video in the
vidsfolder -
Run the following command but replace the parameters as needed
python3 detect_from_video.py --model=efficientdet_d2_coco17_tpu-32/ \
--video_path=vids/smarthome.mp4 \
--labelmap=mscoco_label_map.pbtxt
- Your video output should be inside the
outputsfolder