How to Use .xml annotations to create databunch for model training?

I have an image dataset along with .xml annotations for each image. The image name XML file name is same, for example (data/img/img_1.jpg and data/img/img_2.jpg and the correspondent XML files name are data/annotate/img_1.xml , data/annotate/img_2.xml).
How I can load both to create data bunch so I can feed them to the learner?
I tried a lot searching on the internet but I am new in this so couldn’t get much help in this regards. Anybody can guide me towards the solution, I am thanking you in advance.

You’d normally read the xml into something like NumPy or pandas and then work from there

Thank you for the time but can briefly explain with a sample code, Thanks in advance.

Any advance with this?
I’m in the same situation

Thanks

Can someone give a better answer?

I think @muellerzr was trying to provide a hint, but not give you the full answer, because some things are worth figuring out on your own. Also, there’s probably not an “out-of-the-box” solution for this exact problem.

So I’ll provide another tip that is neither a detailed answer nor example code, because that would require knowing a lot more about the structure of your .xml files:

Try using xml2dict to read the file in as a dict, which can then be easily transformed into a pandas.DataFrame

1 Like