/abandoned_object_detection

TensorRT YOLOv4, YOLOv3, SSD, MTCNN, and GoogLeNet

Primary LanguagePythonMIT LicenseMIT

abandoned_object_detection

Table of Contents

Description

This is an Abandoned Object Detection (AOD) using a TensorRT-optimized YOLOv4(416 frame size) as the object detection model.

Note that this AOD system is for the five objects below:

  • backpack
  • umbrella
  • handback
  • suitcase
  • cell phone

Here's an example of the screenshot of the AOD demo.

The flow of the AOD

  • First display : object detection

                Person, cellphone and backpack are detected in the following situation.
                When persons or objects are detected, bounding boxes are displayed and the person or object's names are displayed at the top.                  
    

  • Second display : "Warning" text and yellow bounding boxes for the objects that may be left behind

                After that, the yellow bounding boxes are displayed for the target objects 
                after a certain distance and time has passed between the centroids of the detected person and the objects.
                At that time, the word "warning", which means the objects may be left behind, is displayed.
    

  • Last display : "Abandoned" text and red bounding boxes for the abandoned objects

                After that, the red bounding boxes with "abandoned" text will be displayed for the abandoned objects when a certain amount of time has passed.
    

Here's the overview for the AOD system.

  • Overview

  • The flow for system processing

  • The flow of the data processing on Node-RED

  • Dashboard on Node-RED

Prerequisites

  • NVIDIA Jetson with JetPack 4.5 or later
  • USB camera

Installation

Install docker-compose (You need to have docker-compose with the runtime paramter support.)

  1. If you already have pip installed with apt in your Jetson. Remove it.
$ sudo apt remove python3-pip
  1. Install pip from PyPA
$ sudo apt update
$ sudo apt install curl python3-testresources
$ curl -kL https://bootstrap.pypa.io/get-pip.py | python3
  1. Install docker-compose
$ python3 -m pip install --user docker-compose
  1. Add $HOME/.local/bin directory in your PATH.
  2. Comfirm docker-compose installed successfully.
$ docker-compose --version
  1. Add "default-runtime": "nvidia" to your /etc/docker/daemon.json configuration file to build the TensorRT plugin. And restart the docker service or reboot your system.
{
  "runtimes": {
      "nvidia": {
          "path": "nvidia-container-runtime",
          "runtimeArgs": []
      }
  },
  "default-runtime": "nvidia"
}
  1. Clone this repository.
$ git clone https://github.com/MACNICA-CLAVIS-NV/abandoned_object_detection
  1. Add the execution permission to the shell scripts.
$ cd abandoned_object_detection
$ chmod +x ./scripts/*.sh

Usage

Start the services of the application

$ ./scripts/compose-up.sh

You can see the dashboard at http://localhost:1880/ui

Stop the services of the application

$ ./scripts/compose-down.sh

Troubleshooting

If you see the following error,

inference_1  | -------------------------------------------------------------------
inference_1  | PyCUDA ERROR: The context stack was not empty upon module cleanup.
inference_1  | -------------------------------------------------------------------
inference_1  | A context was still active when the context stack was being
inference_1  | cleaned up. At this point in our execution, CUDA may already
inference_1  | have been deinitialized, so there is no way we can finish
inference_1  | cleanly. The program will be aborted now.
inference_1  | Use Context.pop() to avoid this problem.
inference_1  | -------------------------------------------------------------------

please run the PyCUDA auto initialization alone with the following commands.

  1. Execute a shell in the conatainer.
$ ./scripts/docker_run.sh 
  1. Run the following python command.
# python3 -c "import pycuda.autoinit"
  1. Exit from the shell in the container.
# exit

Then restat the abandoned_object_detection application.

Licenses

Contents

Report OSS activity of Abandoned Object Detection & FAQ