Skip to content

Commit

Permalink
Merge pull request #21 from nathanrooy/dev
Browse files Browse the repository at this point in the history
migrate deep_sort to newest version of tf
  • Loading branch information
nathanrooy authored Apr 10, 2021
2 parents f7ef95d + 480f7a3 commit 6a5fc82
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 1,836 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ RUN apt-get install -y gfortran
RUN apt-get install -y libatlas-base-dev
RUN apt-get install -y python3-scipy

# install remaining dependencies
RUN pip3 install filterpy==1.4.5 --no-deps

# download tensorflow 2.4 wheel and install
WORKDIR /root
RUN apt-get install -y wget
Expand Down Expand Up @@ -51,6 +48,15 @@ RUN pip3 install flatbuffers==1.12
# install tflite runtime
RUN pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl

# install umt
# install some additional tools for debugging
RUN apt-get install -y feh
RUN apt-get install -y vim

# install git
RUN apt-get install -y git

# install deep sort
RUN pip3 install git+https://github.com/mk-michal/deep_sort

# install umt
RUN pip3 install git+https://github.com/nathanrooy/rpi-urban-mobility-tracker --no-deps
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The Raspberry Pi Urban Mobility Tracker is the simplest way to track and count p
</tr>
</table>

## Install
## Install (Raspberry Pi)
1) UMT has been dockerized in order to minimize installation friction. Start off by <a href="https://docs.docker.com/engine/install/">installing Docker</a> on your Raspbery Pi or what ever you plan on using. The instructions below assume a Raspberry Pi v4 with <a href="https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2020-12-04/">Raspberry Pi OS 2020-12-02</a>. This is also a good time to add non-root users to the Docker user group. As an example, to add the Raspberry pi default user `pi`:
```sh
sudo usermod -aG docker pi
Expand Down Expand Up @@ -87,6 +87,19 @@ umt -video highway_01.mp4
```
If everything worked correctly, you should see a directory labeled `output` filled with 10 annotated video frames.

## Install (Ubuntu)
First, create a new virtualenv then install the TensorFlow Lite runtime package for Python:

```sh
pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
```

Then finish with the following:
```sh
pip install git+https://github.com/nathanrooy/rpi-urban-mobility-tracker
```

Lastly, test the install by running step #6 from the Raspberry Pi install instructions above.

## Model Choice
The default deep learning model is the MobileNet v1 which has been trained on the <a target="_blank" href="http://cocodataset.org">COCO dataset</a> and quantized for faster performance on edge deployments. Another good model choice is <a target="_blank" href="https://github.com/nathanrooy/ped-net">PedNet</a> which is also a quantized MobileNet v1 however, it's been optimized specifically for pedestrians, cyclsts, and vehicles. To use PedNet, simply download it from its repo here: https://github.com/nathanrooy/ped-net or clone it.
Expand Down
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
deep_sort @ https://github.com/mk-michal/deep_sort/archive/master.zip#egg=deep_sort-1.2.0
filterpy
imutils
numpy
pillow
opencv-python
scipy
scikit-image
tensorflow
22 changes: 8 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

with open("README.md", "r") as fh:
long_description = fh.read()


with open('requirements.txt') as f:
required = f.read().splitlines()

setup(
name='umt',
version='0.0.1',
version='0.0.2',
author='Nathan A. Rooy',
author_email='[email protected]',
url='https://github.com/nathanrooy/rpi-urban-mobility-tracker',
Expand All @@ -19,16 +22,7 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent'
],
install_requires=[
'filterpy',
'imutils',
'numpy',
'pillow',
'opencv-python',
'scipy',
'scikit-image',
'tensorflow'
],
install_requires=required,
entry_points={
'console_scripts': [
'umt = umt.umt_main:main'
Expand All @@ -40,7 +34,7 @@
'models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29/detect.tflite',
'models/tpu/mobilenet_ssd_v2_coco_quant/coco_labels.txt',
'models/tpu/mobilenet_ssd_v2_coco_quant/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite',
'deep_sort/*'
]
'deep_sort/*'
]
},
)
1 change: 0 additions & 1 deletion umt/deep_sort/__init__.py

This file was deleted.

54 changes: 0 additions & 54 deletions umt/deep_sort/detection.py

This file was deleted.

213 changes: 0 additions & 213 deletions umt/deep_sort/generate_detections.py

This file was deleted.

Loading

0 comments on commit 6a5fc82

Please sign in to comment.