@@ -18,15 +18,16 @@ def test_parse_sharks_coco(self):
18
18
parsed = folderparser .parsefolder (sharksfolder )
19
19
testImagePath = "/train/sharks_mp4-20_jpg.rf.90ba2e8e9ca0613f71359efb7ed48b26.jpg"
20
20
testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
21
- assert len (testImage ["annotationfile" ]["parsed" ] ["annotations" ]) == 5
21
+ assert len (json . loads ( testImage ["annotationfile" ]["rawText" ]) ["annotations" ]) == 5
22
22
23
23
def test_parse_sharks_createml (self ):
24
24
sharksfolder = f"{ thisdir } /../datasets/sharks-tiny-createml"
25
25
parsed = folderparser .parsefolder (sharksfolder )
26
26
testImagePath = "/train/sharks_mp4-20_jpg.rf.5359121123e86e016401ea2731e47949.jpg"
27
27
testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
28
- assert len (testImage ["annotationfile" ]["parsed" ]) == 1
29
- imgReference = testImage ["annotationfile" ]["parsed" ][0 ]
28
+ imgParsedAnnotations = json .loads (testImage ["annotationfile" ]["rawText" ])
29
+ assert len (imgParsedAnnotations ) == 1
30
+ imgReference = imgParsedAnnotations [0 ]
30
31
assert len (imgReference ["annotations" ]) == 5
31
32
32
33
def test_parse_sharks_yolov9 (self ):
@@ -44,10 +45,9 @@ def test_parse_mosquitos_csv(self):
44
45
testImagePath = "/train_10308.jpeg"
45
46
testImage = [i for i in parsed ["images" ] if i ["file" ] == testImagePath ][0 ]
46
47
assert testImage ["annotationfile" ]["name" ] == "annotation.csv"
47
- headers = testImage ["annotationfile" ]["parsed" ]["headers" ]
48
- lines = testImage ["annotationfile" ]["parsed" ]["lines" ]
49
- assert headers == "img_fName,img_w,img_h,class_label,bbx_xtl,bbx_ytl,bbx_xbr,bbx_ybr\n "
50
- assert lines == ["train_10308.jpeg,1058,943,japonicus/koreicus,28,187,908,815\n " ]
48
+ expected = "img_fName,img_w,img_h,class_label,bbx_xtl,bbx_ytl,bbx_xbr,bbx_ybr\n "
49
+ expected += "train_10308.jpeg,1058,943,japonicus/koreicus,28,187,908,815\n "
50
+ assert testImage ["annotationfile" ]["rawText" ] == expected
51
51
52
52
53
53
def _assertJsonMatchesFile (actual , filename ):
0 commit comments