Object Detection could not parse xml file

I was following the link below.

When I tried to train with the following command, I saw the error message.

    !python3 train_ssd.py --dataset-type=voc --data=data/jetbot
    --model-dir=models/jetbot --batch-size=2 --workers=1 --epochs=1
2022-11-04 20:43:30 - Namespace(balance_data=False, base_net=None, base_net_lr=0.001, batch_size=2, checkpoint_folder='models/jetbot', dataset_type='voc', datasets=['data/jetbot'], debug_steps=10, extra_layers_lr=None, freeze_base_net=False, freeze_net=False, gamma=0.1, log_level='info', lr=0.01, mb2_width_mult=1.0, milestones='80,100', momentum=0.9, net='mb1-ssd', num_epochs=1, num_workers=1, pretrained_ssd='models/mobilenet-v1-ssd-mp-0_675.pth', resolution=300, resume=None, scheduler='cosine', t_max=100, use_cuda=True, validation_epochs=1, validation_mean_ap=False, weight_decay=0.0005)
2022-11-04 20:43:30 - model resolution 300x300
2022-11-04 20:43:30 - SSDSpec(feature_map_size=19, shrinkage=16, box_sizes=SSDBoxSizes(min=60, max=105), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - SSDSpec(feature_map_size=10, shrinkage=32, box_sizes=SSDBoxSizes(min=105, max=150), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - SSDSpec(feature_map_size=5, shrinkage=64, box_sizes=SSDBoxSizes(min=150, max=195), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - SSDSpec(feature_map_size=3, shrinkage=100, box_sizes=SSDBoxSizes(min=195, max=240), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - SSDSpec(feature_map_size=2, shrinkage=150, box_sizes=SSDBoxSizes(min=240, max=285), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - SSDSpec(feature_map_size=1, shrinkage=300, box_sizes=SSDBoxSizes(min=285, max=330), aspect_ratios=[2, 3])
2022-11-04 20:43:30 - Prepare training datasets.
warning - image 20221031-132300 has no box/labels annotations, ignoring from dataset
warning - image 20221031-132304 has no box/labels annotations, ignoring from dataset
Traceback (most recent call last):
  File "train_ssd.py", line 257, in <module>
    target_transform=target_transform)
  File "/content/jetson-inference/python/training/detection/ssd/vision/datasets/voc_dataset.py", line 36, in __init__
    self.ids = self._read_image_ids(image_sets_file) #202200-000000 shape
  File "/content/jetson-inference/python/training/detection/ssd/vision/datasets/voc_dataset.py", line 112, in _read_image_ids
    if self._get_num_annotations(image_id) > 0: #202200-001234 shape
  File "/content/jetson-inference/python/training/detection/ssd/vision/datasets/voc_dataset.py", line 125, in _get_num_annotations
    objects = ET.parse(annotation_file).findall("object") #202200-001234.xml
  File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1197, in parse
    tree.parse(source, parser)
  File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 598, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

As a result of many searches, it is said that it is a problem that occurs when there is a problem with the format or content of the xml file, but I don’t know what is wrong with my xml file.

This is one of my xml file delow Annotations folder
Other xml files are in the same format.

    <annotation>
        <filename>20221101-065756.jpg</filename>
        <folder>jetbot</folder>
        <source>
            <database>jetbot</database>
            <annotation>custom</annotation>
            <image>custom</image>
        </source>
        <size>
            <width>1280</width>
            <height>720</height>
            <depth>3</depth>
        </size>
        <segmented>0</segmented>
        <object>
            <name>jetbot</name>
            <pose>unspecified</pose>
            <truncated>0</truncated>
            <difficult>0</difficult>
            <bndbox>
                <xmin>100</xmin>
                <ymin>187</ymin>
                <xmax>514</xmax>
                <ymax>678</ymax>
            </bndbox>
        </object>
    </annotation>

Also, I checked my file route again and again, but there was no problem.
Any advice would be so appreciated.

Hi,

There are some warning messages about image 20221031-132300 and image 20221031-132304.

warning - image 20221031-132300 has no box/labels annotations, ignoring from dataset
warning - image 20221031-132304 has no box/labels annotations, ignoring from dataset

Could you share the XML of these two images with us first?
Thanks.

Closing this topic as a duplicate of https://github.com/dusty-nv/jetson-inference/issues/1513