glenn-jocher
commited on
Commit
•
caf7ad0
1
Parent(s):
055e72a
Allow 3-point segments (#6938)
Browse filesMay resolve https://github.com/ultralytics/yolov5/issues/6931
- utils/datasets.py +1 -1
utils/datasets.py
CHANGED
@@ -906,7 +906,7 @@ def verify_image_label(args):
|
|
906 |
nf = 1 # label found
|
907 |
with open(lb_file) as f:
|
908 |
lb = [x.split() for x in f.read().strip().splitlines() if len(x)]
|
909 |
-
if any(
|
910 |
classes = np.array([x[0] for x in lb], dtype=np.float32)
|
911 |
segments = [np.array(x[1:], dtype=np.float32).reshape(-1, 2) for x in lb] # (cls, xy1...)
|
912 |
lb = np.concatenate((classes.reshape(-1, 1), segments2boxes(segments)), 1) # (cls, xywh)
|
|
|
906 |
nf = 1 # label found
|
907 |
with open(lb_file) as f:
|
908 |
lb = [x.split() for x in f.read().strip().splitlines() if len(x)]
|
909 |
+
if any(len(x) > 6 for x in lb): # is segment
|
910 |
classes = np.array([x[0] for x in lb], dtype=np.float32)
|
911 |
segments = [np.array(x[1:], dtype=np.float32).reshape(-1, 2) for x in lb] # (cls, xy1...)
|
912 |
lb = np.concatenate((classes.reshape(-1, 1), segments2boxes(segments)), 1) # (cls, xywh)
|