File tree Expand file tree Collapse file tree 1 file changed +75
-1
lines changed
tests/data/serialization/ndjson Expand file tree Collapse file tree 1 file changed +75
-1
lines changed Original file line number Diff line number Diff line change @@ -517,15 +517,89 @@ def video_bbox_label():
517517 })
518518
519519
520+ def video_serialized_bbox_label ():
521+ return {
522+ 'uuid' :
523+ 'b24e672b-8f79-4d96-bf5e-b552ca0820d5' ,
524+ 'dataRow' : {
525+ 'id' : 'cklr9mr4m5iao0rb6cvxu4qbn'
526+ },
527+ 'schemaId' :
528+ 'ckz38ofop0mci0z9i9w3aa9o4' ,
529+ 'classifications' : [],
530+ 'segments' : [{
531+ 'keyframes' : [{
532+ 'frame' : 1 ,
533+ 'bbox' : {
534+ 'top' : 46.0 ,
535+ 'left' : 70.0 ,
536+ 'height' : 249.0 ,
537+ 'width' : 384.0
538+ }
539+ }, {
540+ 'frame' : 5 ,
541+ 'bbox' : {
542+ 'top' : 32.0 ,
543+ 'left' : 70.0 ,
544+ 'height' : 316.0 ,
545+ 'width' : 277.0
546+ }
547+ }]
548+ }, {
549+ 'keyframes' : [{
550+ 'frame' : 9 ,
551+ 'bbox' : {
552+ 'top' : 132.0 ,
553+ 'left' : 70.0 ,
554+ 'height' : 216.0 ,
555+ 'width' : 213.0
556+ }
557+ }, {
558+ 'frame' : 15 ,
559+ 'bbox' : {
560+ 'top' : 74.0 ,
561+ 'left' : 70.0 ,
562+ 'height' : 274.0 ,
563+ 'width' : 288.0
564+ }
565+ }, {
566+ 'frame' : 21 ,
567+ 'bbox' : {
568+ 'top' : 31.0 ,
569+ 'left' : 70.0 ,
570+ 'height' : 317.0 ,
571+ 'width' : 464.0
572+ }
573+ }, {
574+ 'frame' : 29 ,
575+ 'bbox' : {
576+ 'top' : 19.0 ,
577+ 'left' : 70.0 ,
578+ 'height' : 329.0 ,
579+ 'width' : 536.0
580+ }
581+ }]
582+ }]
583+ }
584+
585+
520586def test_serialize_video_objects ():
521587 label = video_bbox_label ()
522588 serialized_labels = NDJsonConverter .serialize ([label ])
523589 label = next (serialized_labels )
590+
591+ manual_label = video_serialized_bbox_label ()
592+
593+ for key in label .keys ():
594+ #ignore uuid because we randomize if there was none
595+ if key != "uuid" :
596+ assert label [key ] == manual_label [key ]
597+
524598 assert len (label ['segments' ]) == 2
525599 assert len (label ['segments' ][0 ]['keyframes' ]) == 2
526600 assert len (label ['segments' ][1 ]['keyframes' ]) == 4
527601
528- #converts back only the keyframes. should be the sum of all prev segments
602+ # # converts back only the keyframes. should be the sum of all prev segments
529603 deserialized_labels = NDJsonConverter .deserialize ([label ])
530604 label = next (deserialized_labels )
531605 assert len (label .annotations ) == 6
You can’t perform that action at this time.
0 commit comments