File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
33import numpy as np
4- import cv2
4+ opencv_installed = True
5+
6+ try :
7+ import cv2
8+ except ModuleNotFoundError as e : # can alternatively drop the boolean check for NameError exception when cv2 is called
9+ opencv_installed = False
10+
11+
512from edge_impulse_linux .runner import ImpulseRunner
613import math
714import psutil
815
916class ImageImpulseRunner (ImpulseRunner ):
1017 def __init__ (self , model_path : str ):
18+ if not opencv_installed : # can alternatively drop the boolean check for NameError exception when cv2 is called
19+ raise Exception ("OpenCV Not found. To use ImageImpulseRunner, ensure opencv-python>=4.5.1.48 is installed." )
20+
1121 super (ImageImpulseRunner , self ).__init__ (model_path )
1222 self .closed = True
1323 self .labels = []
You can’t perform that action at this time.
0 commit comments