Skip to content

Instantly share code, notes, and snippets.

View thepycoder's full-sized avatar

Victor Sonck thepycoder

View GitHub Profile
[tracker]
enable=1
tracker-width=640
tracker-height=384
gpu-id=0
ll-lib-file=/opt/nvidia/deepstream/deepstream/lib/libnvds_mot_klt.so
#ll-lib-file=/opt/nvidia/deepstream/deepstream/lib/libnvds_nvdcf.so
#ll-config-file=tracker_config.yml
#enable-past-frame=1
enable-batch-process=1
def create_pipeline(self):
# Create pipeline and set version
pipeline = dai.Pipeline()
pipeline.setOpenVINOVersion(version=dai.OpenVINO.Version.VERSION_2021_3)
# Camera specific settings
cam = pipeline.createColorCamera()
cam.setPreviewSize(*self.nn_shape)
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
cam.setInterleaved(False)
def run(self):
pipeline = self.create_pipeline()
# Pipeline defined, now the device is connected to
with dai.Device(pipeline) as device:
# Start pipeline
device.startPipeline()
# Set queues to be read from later
self.high_quality_out = device.getOutputQueue(name="high_quality_out", maxSize=4, blocking=False)
self.detection_out = device.getOutputQueue(name="detection_out", maxSize=4, blocking=False)
def pipe_to_virtual_webcam(self):
with pyvirtualcam.Camera(width=854, height=480, fps=30) as cam:
print(f'Using virtual camera: {cam.device}')
while self.is_running:
frame = self.webcam_queue.get()
cam.send(frame)
cam.sleep_until_next_frame()
@thepycoder
thepycoder / dummy_model.py
Created February 28, 2022 13:58
Dummy Model
from clearml import Task
task = Task.init(project_name="HPO Example", task_name="basic dict example")
example_configuration = {
'epochs': 3,
'lr': 0.001,
'comments': 'I like apple juice'
}
task.connect(example_configuration)
from clearml import Task
task = Task.init(project_name="HPO Example", task_name="basic dict example")
example_configuration = {
'epochs': 3,
'lr': 0.001,
'comments': 'I like apple juice'
}
task.connect(example_configuration)
class Model:
def run():
return example_configuration['epochs'] * 10
model_output = Model().run()
logger = task.get_logger()
logger.report_scalar('Optimization Metric', 'model_output', iteration=0, value=model_output)
from clearml.automation import UniformParameterRange, UniformIntegerParameterRange, DiscreteParameterRange
from clearml.automation import HyperParameterOptimizer
from clearml.automation import GridSearch
from clearml import Task
task = Task.init(project_name='HPO Code',
task_name='basic dict optimizer',
task_type=Task.TaskTypes.optimizer,
reuse_last_task_id=False)