File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 1818from .model_store import get_model_file
1919from ..utils .objects import Detect_Object
2020from ..utils .functional import *
21+ from typing import Iterable
2122
2223class YoloV8s :
2324 def __init__ (
@@ -204,17 +205,20 @@ def __call__(self, img):
204205 pred , self .prob_threshold , self .nms_threshold
205206 )[0 ]
206207
207- objects = [
208- Detect_Object (
209- obj [5 ],
210- obj [4 ],
211- (obj [0 ] - (wpad / 2 )) / scale ,
212- (obj [1 ] - (hpad / 2 )) / scale ,
213- (obj [2 ] - obj [0 ]) / scale ,
214- (obj [3 ] - obj [1 ]) / scale ,
215- )
216- for obj in result
217- ]
208+ if isinstance (result , Iterable ):
209+ objects = [
210+ Detect_Object (
211+ obj [5 ],
212+ obj [4 ],
213+ (obj [0 ] - (wpad / 2 )) / scale ,
214+ (obj [1 ] - (hpad / 2 )) / scale ,
215+ (obj [2 ] - obj [0 ]) / scale ,
216+ (obj [3 ] - obj [1 ]) / scale ,
217+ )
218+ for obj in result
219+ ]
220+ else :
221+ objects = []
218222
219223 return objects
220224
You can’t perform that action at this time.
0 commit comments