diff --git a/sahi/models/mmdet.py b/sahi/models/mmdet.py index 594264703..fb7000ee4 100644 --- a/sahi/models/mmdet.py +++ b/sahi/models/mmdet.py @@ -16,7 +16,6 @@ try: - check_requirements(["torch", "mmdet", "mmcv", "mmengine"]) from mmdet.apis.det_inferencer import DetInferencer @@ -104,7 +103,6 @@ def __init__( image_size: int = None, scope: str = "mmdet", ): - if not IMPORT_MMDET_V3: raise ImportError("Failed to import `DetInferencer`. Please confirm you have installed 'mmdet>=3.0.0'") diff --git a/sahi/predict.py b/sahi/predict.py index 04dc6aeed..1740ae9b3 100644 --- a/sahi/predict.py +++ b/sahi/predict.py @@ -674,7 +674,7 @@ def predict( export_format=visual_export_format, ) if not novisual and source_is_video: # export video - output_video_writer.write(result["image"]) + output_video_writer.write(cv2.cvtColor(result["image"], cv2.COLOR_RGB2BGR)) # render video inference if view_video: diff --git a/sahi/utils/cv.py b/sahi/utils/cv.py index 269dc254c..adb1677dc 100644 --- a/sahi/utils/cv.py +++ b/sahi/utils/cv.py @@ -338,7 +338,7 @@ def read_video_frame(video_capture, frame_skip_interval): if not ret: print("\n=========================== Video Ended ===========================") break - yield Image.fromarray(frame) + yield Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) else: while video_capture.isOpened: @@ -349,7 +349,7 @@ def read_video_frame(video_capture, frame_skip_interval): if not ret: print("\n=========================== Video Ended ===========================") break - yield Image.fromarray(frame) + yield Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) if export_visual: # get video properties and create VideoWriter object