The job of the camera processor is to detect all potential subjects and track the subjects that have been selected by the camera operators using the Interface. The camera operators only see the detections within a frame, and the subjects they started tracking. The tracking of subjects is performed over multiple cameras, notifying the camera operator when a subject is re-identified.
The inner workings of the camera processor consist of three parts. The input processed by the pipeline and sent to either other camera processors or the interface.
There are two inputs available to the camera processor, the unaltered video stream and commands/feature maps sent by the orchestrator.
The video stream is sent by the video forwarder. This video forwarder previously encoded the camera stream to HLS which is used by the camera processor. Other input methods also exist, mainly image capture and video capture, although both are only used for benchmarking/testing purposes. The HLS stream is wrapped together with the timestamp of the HLS segment so that time can be consistently tracked by both the camera processor and the interface, since both components utilize the same stream. processor/input README
The orchestrator is the point of communication between both the camera processors and the interface. The orchestrator is responsible for correctly distributing the data it gets. The camera processors are responsible for sending the data required to re-identify a subject to all camera processors via the orchestrator. The interface is responsible for choosing an object to track, which is done based on a previous output stage.
The pipeline is responsible for processing all inputs, detecting all potential subject (detection of all objects), and tracking the subjects selected by the camera operator. How these goals are achieved is explained in the pipeline README.
There are two types of outputs: detections possibly associated with a tracked subject, and re-identification data
All detections are shared with the interface to draw all trackable objects. Some detections might have an associated object ID, meaning these detections were already tracked.
All camera processors must be capable of finding the tracked subject. The processors need information about the subject to re-identify them. This information is shared amongst processors.
The camera processor can be run both locally and in Docker although the used system must comply with the set requirements. For differences in CUDA versions, check out the following link to see what distribution is available and choose one. We used the cu101 version because it was available for all of the members of the team.
The following environment variables can be used: (When these are set it overrides the configs.ini values with these)
| Variable | Config.ini value name | Description |
|---|---|---|
| ORCHESTRATOR_URL | Orchestrator.url | The link of the orchestrator websocket |
| HLS_STREAM_URL | Input.hls_url | The stream url of the video forwarder (when set it runs in Input.type "hls") |
| PROCESSOR_MODE | Main.mode | In what mode the container runs |
| DETECTION_ALG | Main.detector | Name of the detection algorithm to use |
| TRACKING_ALG | Main.tracker | Name of the tracking algorithm to use |
| TRACKING_ALG | Main.reid | Name of the re-identification algorithm to use |
CameraProcessor configurations inside the configs.ini file. Let's highlight some of the important ones:
Installing python dependencies: Download Python 3.8 and install the dependencies in requirements.txt + requirements-gpu.txt.
pip install -r requirements.txt
pip install -r requirements-gpu.txt
Then, if you have cuDNN 7.6.5 (for which you have to join the Windows Insider if using on windows) When CUDA 10.1 is installed on your computer (once again, NVIDIA only), you should be able to locally run main.py in the processor directory. This will be able to run the YOLOv5 detection algorithm.
If you want to be able to run it with GPU, it is a lot of hassle for Windows users and not recommended. You need to get the Windows Insider program to use CUDA in WSL2. Windows insider program slows down the speed of pc a lot.
docker-compose up in the root to build the container for deployment.docker-compose up in the root to build the container for deployment.docker-compose up in the root to build the container for deployment.To verify the detection/tracking/re-identifying running inside Docker it is possible to stream to the localhost. Add lines the following lines to the docker-compose.yml file inside the root inside the cameraprocessor service:
ports:
- 9090:9090
Set the PROCESSOR_MODE environment variable to: "tornado".
Open the link printed in the console when running docker-compose up and the stream will get shown after a bit.
We use Pytest for testing the code which makes it easy to see the coverage. We can run the unit tests locally and inside Docker. The integration tests can only be run without changing the code inside Docker.
For Docker, the setup and commands are already included inside the Dockerfile, these do not need any tweaking. When running the tests locally inside PyCharm make sure the testing library has been set to Pytest for easy development. Create a Pytest configuration in PyCharm and test the unit tests folder.
We use Pylint for python code quality assurance.
Input following command terminal:
pip install pylint
Install the PyCharm plugin:
Control+Alt+S to open PyCharm settings.
Navigate to Settings>Plugins.
Search for pylint.
Install Pylint plugin.
Control+Alt+S to open PyCharm settings.
Navigate to Settings>Other Settings>Pylint.
Set up a link to Pylint and test settings.
Select the path to .pylintrc file (should be at the root of the project).
Click apply.
Navigate to Edtior>Inspections>Pylint
Check Pylint real-time scan
Mark desired folder as Excluded in PyCharm (for local development).
Add folder name to ignore= in pylintrc (for CI pipeline).
Content type
Image
Digest
Size
3.3 GB
Last updated
over 5 years ago
docker pull tracktech/processor