コード例 #1
0
    def test_parser_serialize(self):
        """ test basic serialization with parser """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno2.class_label = 'person'
        obj = [testanno1, testanno1, testanno2]

        string = self.parser.serialize(obj)
        self.assertEqual(string, darknet_string)
コード例 #2
0
ファイル: test_annotation_cvc.py プロジェクト: czhu12/brambox
    def test_serialize(self):
        """ test if basic serialize works """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno2.x_top_left = 3
        obj = [testanno1, testanno1, testanno2]

        string = self.parser.serialize(obj)
        self.assertEqual(string, cvc_string)
コード例 #3
0
    def test_serialize(self):
        """ test if basic serialize works """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno2.class_label = 'person'
        obj = [testanno1, testanno1, testanno2]

        string = self.parser.serialize(obj)
        self.assertEqual(string, dollar_string)
コード例 #4
0
    def test_parser_serialize(self):
        """ test basic serialization with parser """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno2.class_label = 'person'
        obj = {
            'img_1': [testanno1, testanno2],
            'img_2': [testanno1, testanno1, testanno1]
        }

        string = self.parser.serialize(obj)
        self.assertEqual(string, yaml_string)
コード例 #5
0
    def test_create_method(self):
        """ Test the different create method signatures """
        anno = Annotation.create()
        self.assertIsInstance(anno, Annotation)

        self.anno.class_label = 'randomlabel'
        anno = Annotation.create(self.anno)
        self.assertEqual(anno, self.anno)

        det = Detection()
        det.class_label = 'test'
        anno = Annotation.create(det)
        self.assertEqual(anno.class_label, 'test')
        self.assertEqual(anno.occluded, False)
コード例 #6
0
    def test_create_method(self):
        """ Test the different create method signatures """
        det = Detection.create()
        self.assertIsInstance(det, Detection)

        self.det.class_label = 'randomlabel'
        det = Detection.create(self.det)
        self.assertEqual(det, self.det)

        anno = Annotation()
        anno.class_label = 'test'
        det = Detection.create(anno)
        self.assertEqual(det.class_label, 'test')
        self.assertAlmostEqual(det.confidence, 1.0)
コード例 #7
0
    def test_serialize_ignore_lost(self):
        """ Test serialization behaviour of parser with lost annotations """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno3 = Annotation()
        testanno2.class_label = 'person'
        testanno3.lost = True
        obj = [
            testanno3, testanno1, testanno3, testanno1, testanno2, testanno3
        ]

        string = self.parser.serialize(obj)
        self.assertEqual(string, darknet_string)
コード例 #8
0
    def test_parser_serialize(self):
        """ test basic serialization with parser """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno1.class_label = 'Person'
        testanno2.class_label = 'Cyclist'
        obj = [testanno1, testanno1, testanno2]

        string = self.parser.serialize(obj)
        self.assertEqual(string, kitti_string)
コード例 #9
0
    def test_serialize(self):
        """ test basic serialization with parser """
        testanno1 = Annotation()
        testanno2 = Annotation()
        testanno2.class_label = 'person'
        testanno2.object_id = 1
        testanno2.difficult = True
        obj = {
            'img_1': [testanno1, testanno2],
            'img_2': [testanno1, testanno1, testanno1],
        }

        string = self.parser.serialize(obj)
        self.assertEqual(string, yaml_string)
コード例 #10
0
 def setUp(self):
     self.anno = Annotation()
コード例 #11
0
    def test_parser_serialize(self):
        """ test basic serialization with parser """
        testanno1 = Annotation()
        testanno1.class_label = 'horse'
        testanno1.x_top_left = 100
        testanno1.y_top_left = 200
        testanno1.width = 200
        testanno1.height = 200
        testanno1.difficult = True
        testanno2 = Annotation()
        testanno2.class_label = 'person'
        testanno2.x_top_left = 1
        testanno2.y_top_left = 2
        testanno2.width = 2
        testanno2.height = 2
        testanno2.occluded = True

        string = self.parser.serialize([testanno1, testanno2])
        self.assertEqual(string, xml_string)