Skip to content

[Fix] Updated EfficientBBoxHead parser to YOLO #166

[Fix] Updated EfficientBBoxHead parser to YOLO

[Fix] Updated EfficientBBoxHead parser to YOLO #166

GitHub Actions / Test Results failed Sep 18, 2024 in 0s

1 fail, 44 pass in 24m 52s

 2 files  ±0   2 suites  ±0   24m 52s ⏱️ +6s
45 tests ±0  44 ✅ ±0  0 💤 ±0  1 ❌ ±0 
92 runs  ±0  89 ✅ ±0  1 💤 ±0  2 ❌ ±0 

Results for commit 1cea014. ± Comparison against earlier commit 026ffc2.

Annotations

Check warning on line 0 in tests.integration.test_sanity

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_custom_tasks (tests.integration.test_sanity)

artifacts/Test Results [ubuntu-latest] (Python 3.10)/pytest.xml [took 3m 53s]
artifacts/Test Results [windows-latest] (Python 3.10)/pytest.xml [took 5m 12s]
Raw output
AssertionError: assert {'config_vers..., 24]}, ...]}} == {'config_vers..., 24]}, ...]}}
  
  Omitting 1 identical items, use -vv to show
  Differing items:
  {'model': {'heads': [{'metadata': {'anchors': None, 'classes': ['motorbike', 'car'], 'conf_threshold': 0.25, 'iou_thre...type': 'float32', 'layout': 'NCD', 'name': 'car-detection-head/boxes_and_keypoints/0', 'shape': [1, 66240, 24]}, ...]}} != {'model': {'heads': [{'metadata': {'anchors': None, 'classes': ['motorbike', 'car'], 'conf_threshold': 0.25, 'iou_thre...type': 'float32', 'layout': 'NCD', 'name': 'car-detection-head/boxes_and_keypoints/0', 'shape': [1, 66240, 24]}, ...]}}
  
  Full diff:
    {
        'config_version': '1.0',
        'model': {
            'heads': [
                {
                    'metadata': {
                        'anchors': None,
                        'classes': [
                            'motorbike',
                            'car',
                        ],
                        'conf_threshold': 0.25,
                        'iou_threshold': 0.45,
                        'max_det': 300,
                        'n_classes': 2,
                        'postprocessor_path': None,
                        'subtype': 'yolov6',
                    },
                    'outputs': [
                        'bbox-head/boundingbox/0',
                        'bbox-head/boundingbox/1',
                        'bbox-head/boundingbox/2',
                    ],
                    'parser': 'YOLO',
                },
                {
                    'metadata': {
                        'classes': [
                            'car',
                        ],
                        'conf_threshold': 0.25,
                        'iou_threshold': 0.45,
                        'max_det': 300,
                        'n_classes': 1,
                        'n_keypoints': 6,
                        'postprocessor_path': None,
                        'subtype': 'yolov7',
                    },
                    'outputs': [
                        'car-detection-head/boxes_and_keypoints/0',
                    ],
  -                 'parser': 'YOLO',
  +                 'parser': 'YoloDetectionNetwork',
                },
                {
                    'metadata': {
                        'anchors': None,
                        'classes': [
                            'motorbike',
                        ],
                        'conf_threshold': 0.25,
                        'iou_threshold': 0.45,
                        'max_det': 300,
                        'n_classes': 1,
                        'n_keypoints': 3,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'motorbike-detection-head/outputs/0',
                        'motorbike-detection-head/outputs/1',
                        'motorbike-detection-head/outputs/2',
                    ],
  -                 'parser': 'YOLO',
  +                 'parser': 'YoloDetectionNetwork',
                },
                {
                    'metadata': {
                        'classes': [
                            'background',
                            'chrysler',
                            'bmw',
                            'ducati',
                            'dodge',
                            'ferrari',
                            'infiniti',
                            'land-rover',
                            'roll-royce',
                            'saab',
                            'Kawasaki',
                            'moto',
                            'truimph',
                            'alfa-romeo',
                            'harley',
                            'honda',
                            'jeep',
                            'aprilia',
                            'piaggio',
                            'yamaha',
                            'buick',
                            'pontiac',
                            'isuzu',
                        ],
                        'is_softmax': False,
                        'n_classes': 23,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'context-brand-segmentation-head/brand_segmentation/0',
                    ],
                    'parser': 'SegmentationParser',
                },
                {
                    'metadata': {
                        'classes': [
                            'background',
                            'blue',
                            'green',
                            'red',
                        ],
                        'is_softmax': False,
                        'n_classes': 4,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'color-segmentation-head/color_segmentation/0',
                    ],
                    'parser': 'SegmentationParser',
                },
                {
                    'metadata': {
                        'classes': [
                            'vehicle',
                        ],
                        'is_softmax': False,
                        'n_classes': 1,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'any-vehicle-segmentation-head/vehicle_segmentation/0',
                    ],
                    'parser': 'SegmentationParser',
                },
                {
                    'metadata': {
                        'classes': [
                            'background',
                            'chrysler',
                            'bmw',
                            'ducati',
                            'dodge',
                            'ferrari',
                            'infiniti',
                            'land-rover',
                            'roll-royce',
                            'saab',
                            'Kawasaki',
                            'moto',
                            'truimph',
                            'alfa-romeo',
                            'harley',
                            'honda',
                            'jeep',
                            'aprilia',
                            'piaggio',
                            'yamaha',
                            'buick',
                            'pontiac',
                            'isuzu',
                        ],
                        'is_softmax': False,
                        'n_classes': 23,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'brand-segmentation-head/brand_segmentation/0',
                    ],
                    'parser': 'SegmentationParser',
                },
                {
                    'metadata': {
                        'classes': [
                            'background',
                            'car',
                            'motorbike',
                        ],
                        'is_softmax': False,
                        'n_classes': 3,
                        'postprocessor_path': None,
                    },
                    'outputs': [
                        'vehicle-type-segmentation-head/vehicle_type_segmentation/0',
                    ],
                    'parser': 'SegmentationParser',
                },
            ],
            'inputs': [
                {
                    'dtype': 'float32',
                    'input_type': 'image',
                    'layout': 'NCHW',
                    'name': 'image',
                    'preprocessing': {
                        'interleaved_to_planar': False,
                        'mean': [
                            123.675,
                            116.28,
                            103.53,
                        ],
                        'reverse_channels': True,
                        'scale': [
                            58.395,
                            57.12,
                            57.375,
                        ],
                    },
                    'shape': [
                        1,
                        3,
                        256,
                        320,
                    ],
                },
            ],
            'metadata': {
                'name': 'parking_lot_model',
                'path': 'parking_lot_model.onnx',
                'precision': 'float32',
            },
            'outputs': [
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'any-vehicle-segmentation-head/vehicle_segmentation/0',
                    'shape': [
                        1,
                        1,
                        256,
                        320,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'bbox-head/boundingbox/0',
                    'shape': [
                        1,
                        7,
                        32,
                        40,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'bbox-head/boundingbox/1',
                    'shape': [
                        1,
                        7,
                        16,
                        20,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'bbox-head/boundingbox/2',
                    'shape': [
                        1,
                        7,
                        8,
                        10,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'brand-segmentation-head/brand_segmentation/0',
                    'shape': [
                        1,
                        23,
                        256,
                        320,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCD',
                    'name': 'car-detection-head/boxes_and_keypoints/0',
                    'shape': [
                        1,
                        66240,
                        24,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'color-segmentation-head/color_segmentation/0',
                    'shape': [
                        1,
                        4,
                        256,
                        320,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'context-brand-segmentation-head/brand_segmentation/0',
                    'shape': [
                        1,
                        23,
                        256,
                        320,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'motorbike-detection-head/outputs/0',
                    'shape': [
                        1,
                        14,
                        32,
                        40,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'motorbike-detection-head/outputs/1',
                    'shape': [
                        1,
                        14,
                        16,
                        20,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCDE',
                    'name': 'motorbike-detection-head/outputs/2',
                    'shape': [
                        1,
                        14,
                        8,
                        10,
                    ],
                },
                {
                    'dtype': 'float32',
                    'layout': 'NCHW',
                    'name': 'vehicle-type-segmentation-head/vehicle_type_segmentation/0',
                    'shape': [
                        1,
                        3,
                        256,
                        320,
                    ],
                },
            ],
        },
    }
parking_lot_dataset = <luxonis_ml.data.datasets.luxonis_dataset.LuxonisDataset object at 0x000001732A7FBF70>
subtests = SubTests(ihook=<_pytest.config.compat.PathAwareHookProxy object at 0x0000017379D7D660>, suspend_capture_ctx=<bound met...tarted' _in_suspended=False> _capture_fixture=None>>, request=<SubRequest 'subtests' for <Function test_custom_tasks>>)

    def test_custom_tasks(parking_lot_dataset: LuxonisDataset, subtests):
        config_file = "tests/configs/parking_lot_config.yaml"
        opts = deepcopy(OPTS) | {
            "loader.params.dataset_name": parking_lot_dataset.dataset_name,
            "trainer.batch_size": 2,
        }
        del opts["trainer.callbacks"]
        model = LuxonisModel(config_file, opts=opts)
        model.train()
        archive_path = Path(
            model.run_save_dir, "archive", model.cfg.model.name
        ).with_suffix(".onnx.tar.xz")
        correct_archive_config = json.loads(
            Path("tests/integration/parking_lot.json").read_text()
        )
    
        with subtests.test("test_archive"):
            assert archive_path.exists()
            with tarfile.open(archive_path) as tar:
                extracted_cfg = tar.extractfile("config.json")
    
                assert extracted_cfg is not None, "Config JSON not found in the archive."
                generated_config = json.loads(extracted_cfg.read().decode())
    
            del generated_config["model"]["heads"][1]["metadata"]["anchors"]
>           assert generated_config == correct_archive_config
E           AssertionError: assert {'config_vers..., 24]}, ...]}} == {'config_vers..., 24]}, ...]}}
E             
E             Omitting 1 identical items, use -vv to show
E             Differing items:
E             {'model': {'heads': [{'metadata': {'anchors': None, 'classes': ['motorbike', 'car'], 'conf_threshold': 0.25, 'iou_thre...type': 'float32', 'layout': 'NCD', 'name': 'car-detection-head/boxes_and_keypoints/0', 'shape': [1, 66240, 24]}, ...]}} != {'model': {'heads': [{'metadata': {'anchors': None, 'classes': ['motorbike', 'car'], 'conf_threshold': 0.25, 'iou_thre...type': 'float32', 'layout': 'NCD', 'name': 'car-detection-head/boxes_and_keypoints/0', 'shape': [1, 66240, 24]}, ...]}}
E             
E             Full diff:
E               {
E                   'config_version': '1.0',
E                   'model': {
E                       'heads': [
E                           {
E                               'metadata': {
E                                   'anchors': None,
E                                   'classes': [
E                                       'motorbike',
E                                       'car',
E                                   ],
E                                   'conf_threshold': 0.25,
E                                   'iou_threshold': 0.45,
E                                   'max_det': 300,
E                                   'n_classes': 2,
E                                   'postprocessor_path': None,
E                                   'subtype': 'yolov6',
E                               },
E                               'outputs': [
E                                   'bbox-head/boundingbox/0',
E                                   'bbox-head/boundingbox/1',
E                                   'bbox-head/boundingbox/2',
E                               ],
E                               'parser': 'YOLO',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'car',
E                                   ],
E                                   'conf_threshold': 0.25,
E                                   'iou_threshold': 0.45,
E                                   'max_det': 300,
E                                   'n_classes': 1,
E                                   'n_keypoints': 6,
E                                   'postprocessor_path': None,
E                                   'subtype': 'yolov7',
E                               },
E                               'outputs': [
E                                   'car-detection-head/boxes_and_keypoints/0',
E                               ],
E             -                 'parser': 'YOLO',
E             +                 'parser': 'YoloDetectionNetwork',
E                           },
E                           {
E                               'metadata': {
E                                   'anchors': None,
E                                   'classes': [
E                                       'motorbike',
E                                   ],
E                                   'conf_threshold': 0.25,
E                                   'iou_threshold': 0.45,
E                                   'max_det': 300,
E                                   'n_classes': 1,
E                                   'n_keypoints': 3,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'motorbike-detection-head/outputs/0',
E                                   'motorbike-detection-head/outputs/1',
E                                   'motorbike-detection-head/outputs/2',
E                               ],
E             -                 'parser': 'YOLO',
E             +                 'parser': 'YoloDetectionNetwork',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'background',
E                                       'chrysler',
E                                       'bmw',
E                                       'ducati',
E                                       'dodge',
E                                       'ferrari',
E                                       'infiniti',
E                                       'land-rover',
E                                       'roll-royce',
E                                       'saab',
E                                       'Kawasaki',
E                                       'moto',
E                                       'truimph',
E                                       'alfa-romeo',
E                                       'harley',
E                                       'honda',
E                                       'jeep',
E                                       'aprilia',
E                                       'piaggio',
E                                       'yamaha',
E                                       'buick',
E                                       'pontiac',
E                                       'isuzu',
E                                   ],
E                                   'is_softmax': False,
E                                   'n_classes': 23,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'context-brand-segmentation-head/brand_segmentation/0',
E                               ],
E                               'parser': 'SegmentationParser',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'background',
E                                       'blue',
E                                       'green',
E                                       'red',
E                                   ],
E                                   'is_softmax': False,
E                                   'n_classes': 4,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'color-segmentation-head/color_segmentation/0',
E                               ],
E                               'parser': 'SegmentationParser',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'vehicle',
E                                   ],
E                                   'is_softmax': False,
E                                   'n_classes': 1,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'any-vehicle-segmentation-head/vehicle_segmentation/0',
E                               ],
E                               'parser': 'SegmentationParser',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'background',
E                                       'chrysler',
E                                       'bmw',
E                                       'ducati',
E                                       'dodge',
E                                       'ferrari',
E                                       'infiniti',
E                                       'land-rover',
E                                       'roll-royce',
E                                       'saab',
E                                       'Kawasaki',
E                                       'moto',
E                                       'truimph',
E                                       'alfa-romeo',
E                                       'harley',
E                                       'honda',
E                                       'jeep',
E                                       'aprilia',
E                                       'piaggio',
E                                       'yamaha',
E                                       'buick',
E                                       'pontiac',
E                                       'isuzu',
E                                   ],
E                                   'is_softmax': False,
E                                   'n_classes': 23,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'brand-segmentation-head/brand_segmentation/0',
E                               ],
E                               'parser': 'SegmentationParser',
E                           },
E                           {
E                               'metadata': {
E                                   'classes': [
E                                       'background',
E                                       'car',
E                                       'motorbike',
E                                   ],
E                                   'is_softmax': False,
E                                   'n_classes': 3,
E                                   'postprocessor_path': None,
E                               },
E                               'outputs': [
E                                   'vehicle-type-segmentation-head/vehicle_type_segmentation/0',
E                               ],
E                               'parser': 'SegmentationParser',
E                           },
E                       ],
E                       'inputs': [
E                           {
E                               'dtype': 'float32',
E                               'input_type': 'image',
E                               'layout': 'NCHW',
E                               'name': 'image',
E                               'preprocessing': {
E                                   'interleaved_to_planar': False,
E                                   'mean': [
E                                       123.675,
E                                       116.28,
E                                       103.53,
E                                   ],
E                                   'reverse_channels': True,
E                                   'scale': [
E                                       58.395,
E                                       57.12,
E                                       57.375,
E                                   ],
E                               },
E                               'shape': [
E                                   1,
E                                   3,
E                                   256,
E                                   320,
E                               ],
E                           },
E                       ],
E                       'metadata': {
E                           'name': 'parking_lot_model',
E                           'path': 'parking_lot_model.onnx',
E                           'precision': 'float32',
E                       },
E                       'outputs': [
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'any-vehicle-segmentation-head/vehicle_segmentation/0',
E                               'shape': [
E                                   1,
E                                   1,
E                                   256,
E                                   320,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'bbox-head/boundingbox/0',
E                               'shape': [
E                                   1,
E                                   7,
E                                   32,
E                                   40,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'bbox-head/boundingbox/1',
E                               'shape': [
E                                   1,
E                                   7,
E                                   16,
E                                   20,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'bbox-head/boundingbox/2',
E                               'shape': [
E                                   1,
E                                   7,
E                                   8,
E                                   10,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'brand-segmentation-head/brand_segmentation/0',
E                               'shape': [
E                                   1,
E                                   23,
E                                   256,
E                                   320,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCD',
E                               'name': 'car-detection-head/boxes_and_keypoints/0',
E                               'shape': [
E                                   1,
E                                   66240,
E                                   24,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'color-segmentation-head/color_segmentation/0',
E                               'shape': [
E                                   1,
E                                   4,
E                                   256,
E                                   320,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'context-brand-segmentation-head/brand_segmentation/0',
E                               'shape': [
E                                   1,
E                                   23,
E                                   256,
E                                   320,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'motorbike-detection-head/outputs/0',
E                               'shape': [
E                                   1,
E                                   14,
E                                   32,
E                                   40,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'motorbike-detection-head/outputs/1',
E                               'shape': [
E                                   1,
E                                   14,
E                                   16,
E                                   20,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCDE',
E                               'name': 'motorbike-detection-head/outputs/2',
E                               'shape': [
E                                   1,
E                                   14,
E                                   8,
E                                   10,
E                               ],
E                           },
E                           {
E                               'dtype': 'float32',
E                               'layout': 'NCHW',
E                               'name': 'vehicle-type-segmentation-head/vehicle_type_segmentation/0',
E                               'shape': [
E                                   1,
E                                   3,
E                                   256,
E                                   320,
E                               ],
E                           },
E                       ],
E                   },
E               }

tests\integration\test_sanity.py:120: AssertionError