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

Support for reading analogue guages #2954

Open
CarbonCollins opened this issue Feb 25, 2024 · 18 comments
Open

Support for reading analogue guages #2954

CarbonCollins opened this issue Feb 25, 2024 · 18 comments
Labels
enhancement New feature or request

Comments

@CarbonCollins
Copy link

The Feature

I have my own water well at home so do not have a water meter installed. However I do have a pressure vessel which water is pumped into where I do have an analogue pressure gauge installed measuring the pressure in bar. A crappy example of the gauge below:

image

Would it be possible to add support to reading one of these gauges so that i can interpret the current pressure value?

@CarbonCollins CarbonCollins added the enhancement New feature or request label Feb 25, 2024
@Slider0007
Copy link
Collaborator

Slider0007 commented Feb 28, 2024

@CarbonCollins:
In principle, this is already supported by the firmware, but you have to train your own tflite model.

I have something similar in place (garden water pressure). This is working for over a year now.
image

@CarbonCollins
Copy link
Author

Do you by chance have an example of the configuration options you have set for this analog ROI processing?

also any pointers and/or the data set you used for your model so that I can figure out how to do mine? Ive not trained a model before. I'm going to start collecting images over the next few days at least. they are not as clear and crisp as the one you posted but are generally in this quiality:

alg_roi
and
7 0_ana1_20240229-214409

@Slider0007
Copy link
Collaborator

Slider0007 commented Mar 1, 2024

@CarbonCollins:
In terms of configuration of analog ROI there is nothing special.

image

In first instance you could test if my trained model is also working for you. I doubt because your pointer and scale looks different, but at least you can try. (Be aware: I only trained from 0.0 - 4.5bar).

ana-pressure-0-6_0003_s1.zip

Here you can find some infos how to train analog pointer: https://github.com/jomjol/neural-network-analog-needle-readout

I collected images, labeled them correctly (be very precise, e.g. 0.7_anyimagename.jpg for a pressure of 0.7 bar) and processed one of the jupyter scripts of github repo. For more detailed info, I have to check my archives (Performed this the last time over a year ago ;-))

BTW: Before you start collecting images I would recommend to improve your image quality.

@CarbonCollins
Copy link
Author

CarbonCollins commented Mar 1, 2024

0-4.5 is still a larger range than what my gauge is used for, pretty much max out a 3 bar :) ill give it a try at least.

as for the image quality im not sure how much more I can improve it, its all running on an ESP32-CAM and I cant seem to get the image any clearer...

in either case Ive given your model a whirl and its a lot closer than what the default model was reporting:
image
the default model was reporting 6 all the time :P

@Slider0007
Copy link
Collaborator

Slider0007 commented Mar 1, 2024

Looks not so bad, result is at least quite close :-)

As long the result is acceptable the image quality is also acceptable ;-) But it could be an improvement in terms of evalutation stability...

For me image looks a little blurry (focus adjustment? -> https://jomjol.github.io/AI-on-the-edge-device-docs/Reference-Image/#focus) and you maybe could get a bit closer, physically or using the new digital zoom functionality which in place since 15.7.0. (Be careful: There are still some quirks in v15.7.0, #2926 (reply in thread) -> produces system crashes and potential timing issues while taking new reference image, just repeat until you're happy with the result)

@CarbonCollins
Copy link
Author

I managed to get a proper printed casing which allowed me to get it a bit closer and time to re-adjust the focus a bit so hopefully a bit less blurry now:
alg_roi
Only thing I have to do now is empty my pressure tank to get images for the guage that is lower than 1.5 bar T.T

@CarbonCollins
Copy link
Author

Just as a thing going forward, is it worth adding these images to a training repo so a more general 0-6 bar guage can be trained? there is at least two of us doing this now :P

@Slider0007
Copy link
Collaborator

Slider0007 commented Mar 5, 2024

@CarbonCollins:
Image looks better than before.

Training image set should at least cover same range than I use 0.0 - 4.5. Send the images (upload here as zipped file) and I'll give it a try to add to the model.

@CarbonCollins
Copy link
Author

Finally had a chance to flush the tank so I have a collection of images

images.tar.gz

@Slider0007
Copy link
Collaborator

@CarbonCollins:
Please find attached the trained model including your images.
ana-pressure-0-6_0004_s2.zip

I wasn't able to fully test on my pressure gauge because garden water is not yet switched on ;-)

@CarbonCollins
Copy link
Author

CarbonCollins commented Apr 10, 2024

Im not sure that model is spitting out the right values currently, it seems much closer than before but also not quite right

image

@Slider0007
Copy link
Collaborator

@CarbonCollins:
I figured out, that there were some wrong labeled images in this region. I removed them and retrained again. Please verify...

  1. Only your images: ana-pressure-0-6_0005_s2_CarbonCollins_only.zip
  2. Including my images: ana-pressure-0-6_0006_s2.zip

@CarbonCollins
Copy link
Author

No problem,

we are off to a good start at least :)
image
this is with model 1. Ill try it out for a few pressure cycles and then Ill also try out model 2 :)

@gobenedikt
Copy link

gobenedikt commented May 3, 2024

Hi, is it possible to train the model on number with two decimals?
I am trying to read a gauge from a scale. So for this to properly make sense, I would need a second decimal digit as well:
image

Is this theoretically possible with this model? or is it limited at 1 decimal?
I cant find any information on it. Thanks so much :)

Or to put differently, can I go beyond 100 digits (0-0.99) to 1000 digits? 0-0.999 ?

@CarbonCollins
Copy link
Author

@Slider0007 Ive tried both models now, the one with just my images in seems to work quite well, the combined one not so much it seems to get a bit confused with the gradation marks. I am assuming that its because my gauge has half the amount of gradation marks as your gauge but that's just a pure guess.

In general though with the combined model I was getting 2.1 when it should have been 2.2 and was also getting 2.2 when it should have been 2.4

@Slider0007
Copy link
Collaborator

@CarbonCollins

Recently I also figured out that the combined model is not working as good as my old dedicated model. It seems that our gauges are too different to combine in one model, at least with my knowledge of model generation.

@hassdevil
Copy link

hassdevil commented Jun 7, 2024

Hi, i have a similar problem.
I have this pressure gauge.
wasserpressure
I tried both of your generated models, gut i think they are too different, cause it didnt worked.
Soo i decided to train my own model. i got the pictures and i have labeld them.
Now i am struggeling with the howto from haverland/Tenth-of-step-of-a-meter-digit#12.
Would one of you be so kind as to help me through the installation anf training as you have already trained your own models?

@nvOC-Stubo
Copy link

nvOC-Stubo commented Oct 10, 2024

Hello all:

I have a Zenner PMN water meter which has the usual odometer for several digits plus 2 analog gauges for gallons and tenths of gallons. I have all but gallons working and getting that working looks to be difficult if not impossible because the needle is clear:
ZennerPMN

My question is about the images used for training a model. How does one generate those? Is it just a matter of checking the box to save the images in Configuration|Raw Images or is there a more controlled way to do that? My meter is not yet installed so I can set it up on the bench and just add a quart of water at time to make the gauge increment but I have no way to control when the image is taken. Is there a better way?

EDIT: The better way is https://github.com/jomjol/water-meter-picture-provider

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

No branches or pull requests

5 participants