Using TensorFlow 2 Detection Model Zoo, we can easily use it for person detection task. It provides a collection of pre-trained models on the COCO 2017 dataset, which can be downloaded from here.
Object detection is a computer vision approach for identifying and locating things in images and videos. Object detection, in particular, creates bounding boxes around identified items, allowing us to see where they are in (and how they move through) a scene.
Detecting objects is a critical task in computer vision. It's used in a variety of settings, including:
- Crowd counting
- Self-driving cars
- Video surveillance
- Face detection
- Person detection
- Anomaly detection
Of course, this isn't a comprehensive list, but it does include some of the most important ways that object detection is influencing our future.
- Create a new virtual environment ( Using
python -m venv venvorconda create -n person_detection python=3.8.6) - Activate the virtual environment (
source venv/bin/activateorconda activate person_detection) - Install tensorflow 2 (
pip install tensorflow==2orconda install -c conda-forge tensorflow) - Install opencv (
pip install opencv-pythonorconda install -c conda-forge opencv) - Install numpy (
pip install numpyorconda install -c conda-forge numpy) - Install matplotlib (
pip install matplotliborconda install -c conda-forge matplotlib) - Optional - Install logging (
pip install logging) - Install argparse (
pip install argparseorconda install -c conda-forge argparse) - Clone this repo (
git clone https://github.com/swapnilvishwakarma/Person_Detection.git) - Go to the
Person_Detectiondirectory (cd Person_Detection) - Run the
python main.py --helpto see the usage of the program - Pass the required arguments to run the program accordingly.
- Download the Dockerfile from this repo (
git clone https://github.com/swapnilvishwakarma/Person_Detection.git) - Note: It uses tensorflow docker image which is compatible with arm64 architecture only, i.e. for M1 based Macs. - Go to the
Person_Detectiondirectory (cd Person_Detection) - Build the docker image (
docker build -t person_detection .) - Run the docker image (
docker run -it -p 8080:8080 -v $(pwd):/home/ubuntu/Person_Detection person_detection) - You can add required arguments after the docker run command to run the program accordingly.