Skip to content

Commit d1e2a6d

Browse files
committed
Fix rbbox
1 parent 7dad6f1 commit d1e2a6d

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

src/superannotate_schemas/schemas/external/vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Bbox(VectorInstance):
5353
points: BboxPoints
5454

5555

56-
class RotatedBoxPoints(VectorInstance):
56+
class RotatedBoxPoints(BaseModel):
5757
x1: StrictNumber
5858
y1: StrictNumber
5959
x2: StrictNumber

tests/test_validators.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,3 +1974,79 @@ def test_validate_video_point_labels_bad_keys(self):
19741974
self.assertFalse(validator.is_valid())
19751975
self.assertEqual(len(validator.generate_report()),416)
19761976

1977+
def test_validate_vector_empty_annotation(self):
1978+
with tempfile.TemporaryDirectory() as tmpdir_name:
1979+
with open(f"{tmpdir_name}/vector_empty.json", "w") as vector_empty:
1980+
vector_empty.write(
1981+
'''
1982+
{
1983+
"metadata":{
1984+
"lastAction":{
1985+
"email":"test@test.com",
1986+
"timestamp":1641910273710
1987+
},
1988+
"width":480,
1989+
"height":270,
1990+
"name":"1 copy_001.jpg",
1991+
"projectId":181302,
1992+
"isPredicted":false,
1993+
"status":"Completed",
1994+
"pinned":false,
1995+
"annotatorEmail":null,
1996+
"qaEmail":null
1997+
},
1998+
"comments":[
1999+
2000+
],
2001+
"tags":[
2002+
2003+
],
2004+
"instances":[
2005+
{
2006+
"type":"rbbox",
2007+
"classId":901659,
2008+
"probability":100,
2009+
"points":{
2010+
"x1":213.57,
2011+
"y1":74.08,
2012+
"x2":275.65,
2013+
"y2":128.66,
2014+
"x3":238.51,
2015+
"y3":170.92,
2016+
"x4":176.43,
2017+
"y4":116.34
2018+
},
2019+
"groupId":0,
2020+
"pointLabels":{
2021+
2022+
},
2023+
"locked":false,
2024+
"visible":true,
2025+
"attributes":[
2026+
2027+
],
2028+
"trackingId":null,
2029+
"error":null,
2030+
"createdAt":"2022-01-11T14:11:30.772Z",
2031+
"createdBy":{
2032+
"email":"test@test.com",
2033+
"role":"Admin"
2034+
},
2035+
"creationType":"Manual",
2036+
"updatedAt":"2022-01-11T14:11:35.852Z",
2037+
"updatedBy":{
2038+
"email":"test@test.com",
2039+
"role":"Admin"
2040+
},
2041+
"className":"df"
2042+
}
2043+
]
2044+
}
2045+
'''
2046+
)
2047+
2048+
2049+
with open(f"{tmpdir_name}/vector_empty.json", "r") as f:
2050+
data = json.loads(f.read())
2051+
validator = AnnotationValidators.get_validator("vector")(data)
2052+
self.assertTrue(validator.is_valid())

0 commit comments

Comments
 (0)