NAV
python

TRACKER INTRODUCTION

Welcome to the REBOTNIX World! You can use our VISIONTOOLS to build your own custom AI pipelines, including Tracking, Training and Inference.

We have language bindings in Python!

SETUP

A REBOTNIX license key is required. Without a valid key the results will be limited to 100 frames.

To utilize your NVIDIA GPU for a speedup please install the CUDA Toolkit as well as CUDnn.

Please use Python version 3.7 and OpenCV version 3.2.

In addition we strongly recommend to install all neccessary python packages within a virtual environment. To do so we are providing a file named "requirements.txt". An example on how to install the packages can be found on the right side.

# execute in terminal
virtualenv -p python3.7 rebotnix_venv
source rebotnix_venv
pip install -r requirements.txt

TRACKING

The REBOTNIX Tracker is an Object tracker and data generator for automatic labeling. This module runs only on a NVIDIA GPU.

from tracker_rebotnix_license import tracker_rebotnix
import sys

# initialize the tracker with an output path and your license key
license_key = ""
datapath = "/path/to/output_dir"
tracker = tracker_rebotnix(datapath, license_key)

# set coorindates in form of tuples in list: (x, y, w, h)
coordinates = "[(535,117, 220, 250)]"

# set one category name
category = ["category_0"]

# input video file
input_path = "./demo_video.mp4"

# set tracking mode to cv2
mode = "cv2"

# set start frame
start_frame = 0

# set max_frames to track
max_frames = 100

# debug mode: write images with visual rectangles to evaluate the tracker 
debugtrack = True

# max objects to track # current only 1
max_obj = 0

# start the tracker
result = tracker.track(coordinates,categories,category,input_path,mode,start_frame,max_obj,max_frames,debugtrack)

# returns a json with all objects
sys.stdout.write(str(result))

The above command returns a list of JSON structured like this:

[
  {
    "projectid": "output_dir",
    "format": ".mp4",
    "imagewidth": 1280,
    "imageheight": 720,
    "imagepath": "/path/to/output_dir/3c0b257037a142bf47782ffc044435ca3744d8a60b3b2e6bf578c8f0_demo_video_001325.jpg",
    "image": "3c0b257037a142bf47782ffc044435ca3744d8a60b3b2e6bf578c8f0_demo_car_001325.jpg",
    "annotations": 
      [
        {
          "x": 535, 
          "y": 117, 
          "width": 220,
          "height": 250,
          "x_rb": 0.50390625,
          "y_rb": 0.33611111111111114,
          "w_rb": 0.171875,
          "h_rb": 0.3472222222222222,
          "category": "category_0"
        }
      ]
  },
  ...
]