Metadata could not be loaded after training complete

Question/Issue:
After the profiling completes, I’m prompted with the following in the Training Output box of the Transfer Learning section:

Model training complete

Metadata could not be loaded after training complete.

Job failed (see above)

Project ID:
142807

Context/Use case:
I’m using a publicly available Lego training dataset to build an AI setup to categorize Lego blocks. The program runs through the Epochs and profiling, but then errors with the above three lines. I’ve tried rerunning the training a couple days later and got the same error.

Hello @jimmejames,

I just had a quick look at your project and I noticed that the labels of your data samples are not properly set.
You have 3672 labels (which are the same than your file names).

I would use no more than 5/6 labels (classes) for an image classification project.

Good luck with your dataset rearrangement and labelling, that’s sometimes a lot of work.

Best,

Louis

Thanks for the quick response!

So I understand your advice, are you saying I have too may different labels? Right now, there are 20 different types of blocks. Then, there are a lot of photos of those 20 different types of blocks (various colors and at different angles).

Are you saying I would have better luck cutting it down from 20 to 6 or 7 different types? I’m wanting to sort the Legos based on shape, so ideally the more shapes, the better. For this application (helping my 4th grade daughter learn about code and PLCs), I really don’t need to support so many different shapes, but it just adds to the wow factor.

Louis is on the EI Team so he has insight into limitations and so we have to respect his 5 to 6 class count suggestion but I would have to prove him correct.

The model is having trouble training since you have 3672 labels that are divining you 3672 classes. So for each class you want to train you are only giving the Model 1 Sample per Class. If I show you a photo of a 6 foot tall walnut grandfather clock with real gold trim and then show you a photo of the building that is Big Ben in London will you declare Big Ben a clock?

So you need to label 3672 files. This will be much much easier outside of EI Studio. Currently the EI Studio Labeling system is cumbersome unless you are very good with a mouse and your finger and wrist dexterity is way above par. I would delete all incorrectly or unlabeled Samples in EI Studio. Then in Windows File Explorer view the images as Tiles. Then select the files that are red and have 8 connection points and rename the files accordingly, e.g., “Red8.image.jpg” and Windows will rename the group of files as “Red8.image (1).jpg”, “Red8.image (2).jpg”, etc. Continue with “Red4”, “Wht8”, “Wht4”, etc.

Then when you import into EI tell the Importer Infer Labels from the Filename.

Note: I did see this: “There are a total of about 3764 unique LEGO Elements used in sets that are currently available for sale.” So perhaps instead of “Red6” you use the Part ID and color such as 3001RED for a Red Brick 2x4.

You can try to use more than 5/6 labels but I have doubts about the accuracy, that will depend on the use case, on the NN complexity and on the hardware target.
I’d suggest you start with a small number of classes, increase it progressively and fine tune your model over time.

Best,

Louis

Sounds great- thanks for the help!

Coincidentally, we’re sorting into a 6 hole pencil holder, so 6 labels is perfect for the application. And, great opportunity for another lesson- risk vs benefit! We’ll relabel starting with a subset of the whole and expand with stretch goals as/if time allows.

Edit: The original source of the information (Francisco Garcia) included a ImageKeySet.csv file that includes all of the file names and then a type, such as this excerpt.

Folder1	Folder2	Name	    Brick                           Type
Cropped Images	Brick_1x1	1_Brick_1x1_180708133346.jpg	Brick 1x1
Cropped Images	Brick_1x1	1_Brick_1x1_180708133400.jpg	Brick 1x1
Cropped Images	Brick_1x1	1_Brick_1x1_180708133725.jpg	Brick 1x1
Cropped Images	Brick_1x1	1_Brick_1x1_180708133739.jpg	Brick 1x1

Is it possible to import this ‘translator’ and use it to identify the blocks? Just asking to understand the options.

1 Like

Almost. Instead of 1_Brick_1x1_180708133346.jpg rename it 1_Brick_1x1.180708133346.jpg Then in EI Studio you will have a label 1_Brick_1x1 to classify on.

More info here.

2 Likes

@MMarcial & @louis Thank you so much for you help! We got the model deployed and will focus on ways to improve our setup and model tuning using images we capture.

I’m very disappointed in the picture quality from the ESP-EYE. I’ve thus far been unable to get a sharp image in Edge Impulse, but I’ll save those questions for another post if I don’t make any progress.

1 Like