Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running tutorial #2

Closed
Mikemraz opened this issue Aug 9, 2018 · 10 comments · Fixed by #7
Closed

error when running tutorial #2

Mikemraz opened this issue Aug 9, 2018 · 10 comments · Fixed by #7

Comments

@Mikemraz
Copy link

Mikemraz commented Aug 9, 2018


# the number of total images and total labels.
cls_names = []
total_images = 0
for gov in govs:
    file_list = os.listdir(base_path + gov + '/Annotations/')
    for file in file_list:
        total_images = total_images + 1
        if file =='.DS_Store':
            pass
        else:
            infile_xml = open(base_path + gov + '/Annotations/' +file)
            tree = ElementTree.parse(infile_xml)
            root = tree.getroot()
            for obj in root.iter('object'):
                cls_name = obj.find('name').text
                cls_names.append(cls_name)
print("total")
print("# of images:" + str(total_images))
print("# of labels:" + str(len(cls_names)))

when running the code above above I got the following error:

Traceback (most recent call last):

  File "D:\software\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-40-c198439a5aec>", line 15, in <module>
    tree = ElementTree.parse(infile_xml)

  File "D:\software\Anaconda\lib\xml\etree\ElementTree.py", line 1196, in parse
    tree.parse(source, parser)

  File "D:\software\Anaconda\lib\xml\etree\ElementTree.py", line 597, in parse
    self._root = parser._parse_whole(source)

  File "<string>", line unknown
ParseError: not well-formed (invalid token): line 1, column 0

Do you have this kind of issue when running the code?

@kaspermak
Copy link

I am also having the same error.
Any solution?

@NoelV94
Copy link

NoelV94 commented Dec 18, 2018

The xml files seem to be corrupted for some reason. I had to import my own image data set and label them using labelIMG. Solved the issue for me

@Bercalle
Copy link

@NoelV94 Could you please explain me how you imported your own image data set and label them?

@watchmexiang
Copy link

Hello, I am going to download the two shared databases and find that they are the same content. What is the difference between the two? Thank you

@NoelV94
Copy link

NoelV94 commented Dec 18, 2018

@NoelV94 Could you please explain me how you imported your own image data set and label them?

I stored my images in a specific folder and labeled each image using labelIMG (https://github.com/tzutalin/labelImg). LabelIMG basically creates XML labels for each image. Move all the corresponding XML files to a separate folder and place them as subdirectories as shown in the image. The format should match the original method. You can look at one of the folders provided in the main dataset to understand it.

seki

@NoelV94
Copy link

NoelV94 commented Dec 18, 2018

Hello, I am going to download the two shared databases and find that they are the same content. What is the difference between the two? Thank you

They seem to have updated the dataset with additional images. I still have an issue with the XML files though. I am currently using my own dataset.

@watchmexiang
Copy link

@NoelV94Thank you for your reply. I want to know if you successfully trained with your data set?

@watchmexiang
Copy link

@NoelV94 Hello, I ran the following author's test program and found that the detected image could not be displayed, but when I stepped through the program, I could display the image. Do you have any problems with this, how to solve it, thank you

@watchmexiang
Copy link

Hello, I ran the following author's test program and found that the detected image could not be displayed, but when I stepped through the program, I could display the image. Do you have any problems with this, how to solve it, thank you

@NoelV94
Copy link

NoelV94 commented Dec 21, 2018

Yes. I was able to successfully train the network using my data set. Also, I have not had any issues while displaying the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants