Skip to content

Commit

Permalink
Fix thermal model, and coord norm.
Browse files Browse the repository at this point in the history
  • Loading branch information
zrezke committed Feb 27, 2024
1 parent 9c1df48 commit 660f3b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion rerun_py/depthai_viewer/_backend/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,11 @@ def update_pipeline(self, runtime_only: bool) -> Message:
if "yolo" in config.ai_model.path:
yolo = self._oak.pipeline.createYoloDetectionNetwork()
yolo.setBlobPath(model_path)
yolo.setConfidenceThreshold(0.5)
if "yolov6n_thermal_people_256x192" == config.ai_model.path:
yolo.setConfidenceThreshold(0.5)
yolo.setNumClasses(1)
yolo.setCoordinateSize(4)
yolo.setIouThreshold(0.5)
cam_node.raw.link(yolo.input)
xlink_out_yolo = self._oak.pipeline.createXLinkOut()
xlink_out_yolo.setStreamName("yolo")
Expand Down
10 changes: 5 additions & 5 deletions rerun_py/depthai_viewer/_backend/packet_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _dai_detections_to_rects_colors_labels(
colors = []
labels = []
for detection in packet.detections:
rects.append(self._rect_from_detection(detection, context.frame_width, context.frame_height))
rects.append(self._rect_from_detection(detection, context.frame_height, context.frame_width))
colors.append([0, 255, 0])
label = ""
# Open model zoo models output label index
Expand Down Expand Up @@ -273,10 +273,10 @@ def _on_age_gender_packet(self, packet: TwoStagePacket, component: NNComponent)

def _rect_from_detection(self, detection: dai.ImgDetection, max_height: int, max_width: int) -> List[int]:
return [
int(max(min(detection.xmin, max_width), 0) * max_width),
int(max(min(detection.xmax, max_height), 0) * max_height),
int(max(min(detection.ymax, max_width), 0) * max_width),
int(max(min(detection.ymin, max_height), 0) * max_height),
int(min(max(detection.xmin, 0.0), 1.0) * max_width),
int(min(max(detection.ymin, 0.0), 1.0) * max_height),
int(min(max(detection.xmax, 0.0), 1.0) * max_width),
int(min(max(detection.ymax, 0.0), 1.0) * max_height),
]


Expand Down
9 changes: 8 additions & 1 deletion rerun_py/depthai_viewer/install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ def download_blobs() -> None:
}
for model, zoo_type in models.items():
# With use_cache=True, blobconverter will not download / move the blob to model_dir...
blobconverter.from_zoo(model, zoo_type=zoo_type, shaves=6, output_dir=model_dir, use_cache=False)
blobconverter.from_zoo(
model,
zoo_type=zoo_type,
shaves=6,
output_dir=model_dir,
use_cache=False,
compile_params=["-ip FP16"] if "thermal" in model else None,
)


def dependencies_installed() -> bool:
Expand Down

0 comments on commit 660f3b4

Please sign in to comment.