ultralytics 8.0.90
actions and docs improvements (#2326)
Co-authored-by: calmisential <xinyu_std@163.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: triple Mu <gpu@163.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com> Co-authored-by: Laughing-q <1185102784@qq.com> Co-authored-by: ran xiao <ben.xiao@me.com> Co-authored-by: rxiao <ran.xiao@silverpond.com.au>
This commit is contained in:
@ -51,6 +51,7 @@ def test_predict_img():
|
||||
model = YOLO(MODEL)
|
||||
seg_model = YOLO('yolov8n-seg.pt')
|
||||
cls_model = YOLO('yolov8n-cls.pt')
|
||||
pose_model = YOLO('yolov8n-pose.pt')
|
||||
im = cv2.imread(str(SOURCE))
|
||||
assert len(model(source=Image.open(SOURCE), save=True, verbose=True)) == 1 # PIL
|
||||
assert len(model(source=im, save=True, save_txt=True)) == 1 # ndarray
|
||||
@ -64,18 +65,20 @@ def test_predict_img():
|
||||
cv2.imread(str(SOURCE)), # OpenCV
|
||||
Image.open(SOURCE), # PIL
|
||||
np.zeros((320, 640, 3))] # numpy
|
||||
assert len(model(batch)) == len(batch) # multiple sources in a batch
|
||||
assert len(model(batch, visualize=True)) == len(batch) # multiple sources in a batch
|
||||
|
||||
# Test tensor inference
|
||||
im = cv2.imread(str(SOURCE)) # OpenCV
|
||||
t = cv2.resize(im, (32, 32))
|
||||
t = torch.from_numpy(t.transpose((2, 0, 1)))
|
||||
t = torch.stack([t, t, t, t])
|
||||
results = model(t)
|
||||
results = model(t, visualize=True)
|
||||
assert len(results) == t.shape[0]
|
||||
results = seg_model(t)
|
||||
results = seg_model(t, visualize=True)
|
||||
assert len(results) == t.shape[0]
|
||||
results = cls_model(t)
|
||||
results = cls_model(t, visualize=True)
|
||||
assert len(results) == t.shape[0]
|
||||
results = pose_model(t, visualize=True)
|
||||
assert len(results) == t.shape[0]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user