Skip to main content

A python library for single-object tracking.

Project description

rbobjecttracking is based on an algorithm I invented called RBOT. it stands for ROI Based Object Tracking.

To use rbobjecttracking, first create your custom dataset using rbot.dataCollector.

from rbot.dataCollector import DataCollector # Import the DataCollector class

data_collector = DataCollector() # Create the DataCollector object
data_collector.collectData() # This will open a GUI window using customtkinter and opencv.

After filling in the text fields and collecting the image samples, train a small model using rbot.trainer.

from rbot.trainer import Trainer # Import the Trainer class

trainer = Trainer(dataset_path="<dataset name that you created>", batch_size=64, img_size=(128, 128), 
                  lr=<your chosen learning rate>, model_path="<path you want to save your model>") # Create the Trainer object
                  
trainer.train(epochs=<number of epochs you want to train for>) # This will train and save the model to your specified model path

After training, you can then start tracking the object with rbot.rbot.

from rbot.rbot import RBOT # Import the RBOT class
import cv2 # Import opencv for accessing the webcam

rbot = RBOT(hsvValues="blue", image_size=(256, 256), minimum_confidence=0.9) # Create the RBOT object
cap = cv2.VideoCapture(0) # Access the webcam

while True:
    ret, frame = cap.read() # Get a frame from the webcam

    processed_frame = rbot.track_object(frame=frame, color=(0, 255, 0), width=2) # Process the frame

    cv2.imshow("processed frame", processed_frame) # Display the proccesed frame
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

You can even use your GPU for training and inference, if needed. You can still get around 20 FPS on a CPU.

rbot = RBOT(hsvValues="blue", image_size=(256, 256), use_cuda=True) Enable cuda while creating the RBOT object

for training (recommended, but you can still train on CPU)

trainer = Trainer(dataset_path="<dataset name that you created>", batch_size=64, img_size=(128, 128), 
                  lr=<your chosen learning rate>, model_path="<path you want to save your model>", use_cuda=True) # Enable CUDA while Creating the Trainer object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rbobjecttracking-2.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rbobjecttracking-2.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file rbobjecttracking-2.0.0.tar.gz.

File metadata

  • Download URL: rbobjecttracking-2.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rbobjecttracking-2.0.0.tar.gz
Algorithm Hash digest
SHA256 71909daee375aa149f0bf19758157ec8f040d81354c81617d7655579252a5891
MD5 95beaad7fc39be194dac1ac16ab6d750
BLAKE2b-256 1e18b1735162b988715fdddcd34f060d8a1fc99ec6ff5eb53e9a47aa483d41e4

See more details on using hashes here.

File details

Details for the file rbobjecttracking-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rbobjecttracking-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed883ea3ed3daa11fde790b9998b455273f58cf0e3c0217cf6f09e9eee28f87a
MD5 d0cd46b50eeb5a8c8a9d455dc9459eef
BLAKE2b-256 6fa5abf32c5b4ca2f60b93df69a9e469cc447369aebec069c2f98d8d1e1afae8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page