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.2.0.tar.gz (8.1 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.2.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rbobjecttracking-2.2.0.tar.gz
Algorithm Hash digest
SHA256 504682e41d0773f70d3443933a9363e62ef155d70e82eef89850916d563bfe0a
MD5 1c1dccb0a5849de6c53afb3b107d811b
BLAKE2b-256 c106b45ddae748df5c215825f5e060f2535b604601edd7f22542141a2ab1a684

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rbobjecttracking-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e01b09980be8b354c70ffda30c24aa40a005056a245421102d75066470a5eb24
MD5 e73f5a6881d1bae55e39f82213046210
BLAKE2b-256 18822443d2c3fa40fcc9d52bdb7c06c1015b1f422a566221143103d43ff7f880

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