ultralytics 8.0.50
AMP check and YOLOv5u YAMLs (#1263)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Troy <wudashuo@vip.qq.com> Co-authored-by: Yonghye Kwon <developer.0hye@gmail.com> Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Huijae Lee <46982469+ZeroAct@users.noreply.github.com>
This commit is contained in:
@ -49,6 +49,8 @@ def test_predict_dir():
|
||||
|
||||
def test_predict_img():
|
||||
model = YOLO(MODEL)
|
||||
seg_model = YOLO('yolov8n-seg.pt')
|
||||
cls_model = YOLO('yolov8n-cls.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,6 +66,18 @@ def test_predict_img():
|
||||
np.zeros((320, 640, 3))] # numpy
|
||||
assert len(model(batch)) == 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)
|
||||
assert len(results) == t.shape[0]
|
||||
results = seg_model(t)
|
||||
assert len(results) == t.shape[0]
|
||||
results = cls_model(t)
|
||||
assert len(results) == t.shape[0]
|
||||
|
||||
|
||||
def test_predict_grey_and_4ch():
|
||||
model = YOLO(MODEL)
|
||||
@ -199,3 +213,6 @@ def test_result():
|
||||
res = model(SOURCE)
|
||||
res[0].plot()
|
||||
print(res[0].path)
|
||||
|
||||
|
||||
test_predict_img()
|
||||
|
Reference in New Issue
Block a user