Vision to Mass Impulse Calculator

Can anyone thing of a simple way to convert a vision impulse with labels like unknown,130, 110, 90 (grams) for an object (say bananas) into an approximate mass calculator?

In between masses could be calculated based on the classification results. Top classification gets main mass then add or subtract some mass based on the second classification pecent? I feel that there should be a better way to do this, possibly with multiple labels each with an exact mass and a different type of neural network. Any suggestions?

Yes, regression model is the right approach here. Aditya (one of our summer interns) is working on a tutorial on this, will ping him this thread.

2 Likes

@Rocksetta sorry for the late response, I was wrapping up some other information. Regarding, your idea of a “mass-based-calculator”, the way I did it was what @janjongboom had suggested earlier, a regression model. The proper way to achieve this visual input to mass is to create an impulse that looks like the following:


Keep in mind that the size of the image and the image parameters (greyscale or RGB) depend very heavily on your dataset. In this way, you can feed in an image and expect a scalar mass as a result. This will only work if/when you are trying to train on a dataset that has different masses and you are trying to predict the mass of a new object found in your dataset. For example, if your dataset had bananas, you would need to train using a dataset of images of bananas at different masses. If you are trying to classify the weight of a banana into closest to a few specific categories, a classification-model would suit your use case better. Mp apologies, my words at the moment might seem super confusing at the moment :sweat_smile: but feel free to continue this thread if you have any more questions, and there will be a tutorial/blog post posted regarding a visual regression model within the next few days, so keep your eyes peeled :slight_smile:. I will be sure to post the tutorial/blog post here when it does get published.

2 Likes

LOL, a 1 day wait is not a late response. :smile:

Thanks so much for the reply Aditya and it completely makes sense. I would have caused myself a huge headache and have done weird calculations with classified labels.

Question: I typically use 30 to 50 images per label but would expect to use much more images for this kind of dataset, as I will use real weighed bananas using multiple image angles. Any opinions on dataset size?

If you see my image above I would train with a standard reference device, possibly a very common pen. Any opinions if that is a good idea or a bad idea?

I guess the unknown image set is anything with a mass of zero!

P.S. I will probably test using my web browser as per my video here

Absolutely stunning how fast edge impulse is. I made the other post about 45 minutes ago. Trained my dataset and have some results. Needs tweaking but generally works. 232 gram banana as 220 grams. Not bad for near zero thought put into this impulse. Thanks so much @Aditya-Mangalampalli and @janjongboom

I am not sure if using a pen as a reference size was helpful in my model, I might try using a persons hand and then allow Calibration for small or large hands. I might also try graph paper background. I was surprised that when I doctored an image reducing the size of the pen, it didn’t adjust the mass very much, not sure if that is the model being good or bad.

Here is an image of the banana to mass WASM output using my index.html and edge impulse’s WA (web assembly) export (a .js file and a .wasm file) to an https website. I just use Githubs Gitpages, active demo here. (Best to use your cell phone as a desktop computer is difficult to position the camera.)

QR code for active browser demo of Banana-Mass
image

To be fair the values are changing very quickly plus/minus probably about 20 grams. Here is a 212 gram banana showing at 210.396. (Lets not talk to a science teacher about significant digits :smile:).

image

Also impressed that my label WASM webpage worked without a single change for the regression results.

P.S. The model was not trained with the scale in the background and I am very sure the model is not reading the values on the scale. LOL.

Once again thanks @janjongboom and @Aditya-Mangalampalli

Brings up an interesting question: How many other types of analysis can Edge Impulse do that the average user does not know about.

  1. I only knew about: single label classified acceleration, sound, vision and multiple individually labelled vision analysis.

  2. I now know about Vision Regression where the output is a floating point value from zero to X (the largest labelled value). I assume regression could work with acceleration and sound and perhaps with multiple objects analysis.

Anything else under the hood of Edge Impulse?

Yeah regression works on other cases as well, I’ve used it f.e. for water flow measuring using a microphone. And here’s @mathijs (ab)using Edge Impulse to train a self driving car model: https://www.edgeimpulse.com/blog/autonomous-driving-using-computer-vision - once you go into expert mode you can kind of build anything.

1 Like