This commit is contained in:
CaCO3
2023-02-21 20:22:41 +01:00
parent be7cd69ee7
commit 15c3596d32
2 changed files with 72 additions and 132 deletions

View File

@@ -1,4 +1,4 @@
# ROI (Region of Interest)
# ROIs (Regions of Interest)
!!! Notes
You are using a neural network approach which is trained to fit as many different type of meters as possible.
@@ -11,7 +11,7 @@ The most critical components for an accurate detection are:
**This must be done manually for each device/installation!**
2. Well trained Models.
2. Using a well trained Model.
Have a look on the [Digital Counters](https://jomjol.github.io/neural-network-digital-counter-readout/) resp. [Analog Needles](https://jomjol.github.io/neural-network-analog-needle-readout) to check if your types are contained. If your number types are **not** contained, you should take the effort to record them so we can add them to the training data. See [Collect images to improve the models](../Learn-models-with-your-own-images) on how to collect new training data.
@@ -28,56 +28,75 @@ For each digit or analog pointer, a ROI must be defined.
You can even have multiple independent **Numbers** (eg. electerical meters mostly have 2 numbers for the high and low tariff).
Depending if you have only one of those types, you can `enable/disable (1)` it on the top left corner:
Depending if you have only one of those types, you can enable/disable `(1)` it on the top left corner:
![](img/initial_setup_3_rois.jpg){: style="width:500px"}
You can switch between the ROIs with the `Drop down box (2)`. If you need additional ROIs or delete them you can do this with the `control at (2)`.
You can switch between the individual ROIs with the Drop down box `(2)`.
If you need additional ROIs or delete them you can do this with the control at `(3)`.
Like for the [Alignment References](../Alignment), you can change the position, size and name of a ROI in the text fields or define them via drag and drop through the mouse button.
Make sure the ROIs are in the right order, matching the significance of a digit/analog counter!
!!! Warning
The order of the ROIs defines how the individual digits are combined to the total number. The first ROI is the digit with the highest order (left side), then the second and so on. You can control the order in the selector tab and change it with the buttons `"move Next"` or `"move Previous"`.
In most cases **digits** are ordered equidistantly (have the same distance between each other) and have the same size.
Bcause of this the Web Interface keeps their sises and distance the same.
If you need individual sizes or distances, untick the settings `(4)`.
In almost all cases the sizes and `y` values should be identical!
The ratio between `x` and `y` might need adjustment. But make sure it is the same for all digits.
Same for the **analog counters**, the sizes should be identical and the `x` and `y` as well.
!!! Note
Don't forget to save the settings with "Save" and do not reboot at this stage.
### Analog Counters
For analog counters the ROI setting is rather straight forward as the meter is usually quadratic with a clear center.
The circle should exactly fit to the outer size of the meter and the cross should be in the middle of the pointer.
TODO rework
As for the reference images you can change position, size and name of the ROI in the text fields or define them via drag and drop through the mouse button.
In most cases the digits are ordered in a equidistantly and have the same size, you can synchronize them with the `control in (4)`.
Don' t forget to save the settings with "Save" and do not reboot at this stage.
### Detail for ROI configuration - Analog Meters
For analog meters the ROI setting is rather straight forward as the meter is usually quadratic with a clear center. The circle should exactly fit to the outer size of the meter and the cross should be in the middle.
Here is an example with the details for the ROI "ana1":
Here is an example with the details for the ROI `ana1`:
![](img/initial_setup_3_analog_example.jpg){: style="width:500px"}
### Detail for ROI configuration - Digital Meters
### Digits
For the Digital Meters it is a little bit more complicated, as there are different options of digital models which can be choosen.
For the digital meters it is a little bit more complicated, as there are different options of digital models, that you can choose.
#### Correct Size for ROI
First of all, choose the right size of the ROI.
The configuration of ROIs differs a bit on the selected model (see below).
1. Digital meter, that only recognized full digits (0, 1, 2, 3, ... 9) - Naming: `dig-class11-....tfl`
If you are in the initial setup, the model will be selectable in the next step. By default it is a `dig-cont` resp. `ana-cont` model.
**Advantage:** broad variety of types included in the training
In [Model Selection](../Choosing-the-Model) you find the differences between the different available models. Pick the one you think fits best your purpose. If you don't get to good result, try another model.
**Disadvantage:** partially rotated numbers cannot be detected
2. Model with sub-digit resolution (0.0, 0.1, 0.2, .... 9.8, 9.9) - Naming: `dig-cont-....tfl` or `dig-class100-....tfl`
Here we only show the different configuration of the ROIs.
**Advantage:** partial numbers can be detected and a better post processing is possible
**Disadvantage:** only limited types of meter types are trained due to the high effort for the training data
Details and the corresponding "perfect" setting is explained here: [Details ROI Configuration](https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/)
1. Digital Meters with only recognized full digits (`0, 1, 2, 3, ... 9`)
Suggested Model: `dig-class11-*.tfl`
**Advantage:** broad variety of types included in the training.
**Disadvantage:** partially rotated numbers cannot be detected.
2. Digital Meters with sub-digit resolution (`0.0, 0.1, 0.2, .... 9.8, 9.9`)
Suggested Model: `dig-cont-*.tfl` or `dig-class100-*.tfl`
**Advantage:** partial numbers can be detected and a better post processing is possible.
**Disadvantage:** only limited types of meter types are trained due to the high effort for the training data.
#### How to setup the digit ROIs perfectly
Details and the corresponding "perfect" setting is explained below.
For a first run you can choose the following general settings:
* There is an inner and an outer frame for the ROIs.
@@ -90,33 +109,7 @@ For a first run you can choose the following general settings:
| :x: **Not** Okay | ![](img/bw_not_okay_big.jpg){: style="width:80px"}| ![](img/wb_not_okay_big.jpg){: style="width:80px"}|
## Correct Size for ROI
Choose the right size of the ROI.
The configuration of ROIs differs a bit on the selected model.
If you are in the initial setup, the model will be selectable in the next step. By default it is a `dig-cont` resp. `ana-cont` model.
In [Model Selection](../Choosing-the-Model) you find the differences between the different available models. Pick the one you think fits best your purpose. If you don't get to good result, try another model.
Here we only show the different configuration of the ROIs.
## Digit Model Selection
### dig-class11 Configuration
##### Setup using `dig-class11` models
`dig-class11` - Models recognize the **complete digit only**. Here it is not relevant if the ROI fits the Border of the digit window.
For this model, there should be a border of `20%` of the image size around the number itself. This border is shown in the ROI setup image by the inner thinner rectangle. This rectangle should fit perfectly around the number when the number has not started to rotate to the next position:
@@ -133,15 +126,16 @@ For this model, there should be a border of `20%` of the image size around the n
If you have perfect alignment and still are not getting satisfying results, most probably your numbers are not part of the training data yet. See [Collect images to improve the models](../Learn-models-with-your-own-images) on how to collect new training data.
### dig-class100 / dig-cont Configuration
##### Setup using `dig-class100` or `dig-cont` Models
These models recognize the tenths (fractions) between the numbers. This model requires a different ROI setup; the height must be set differently and more accurately.
These models recognize the **tenths** (fractions) between the numbers.
Those models require a different ROI setup; **the height must be set differently and more accurately**.
First, the width can be set as for `dig-class11`, i.e. `20%` margin left and right.
First, the width can be set like for a `dig-class11` model, i.e. `20%` margin left and right.
<img width="455" alt="ROI-setup" src="https://user-images.githubusercontent.com/412645/199028748-c48ef5bb-a8d4-4c77-9faf-763e6cf77351.png">
The height of the outer rectangle should be set to the upper and lower edge of the number window. To achieve this setting, you need to unlock the aspect ratio:
The height of the outer rectangle should be set to the upper and lower edge of the number window. To achieve this, you might need to unlock the aspect ratio:
<img width="168" alt="unlockAspectRatio" src="https://user-images.githubusercontent.com/412645/199028590-21708ff3-15a3-4415-89b1-c2affcfce003.png">
@@ -153,10 +147,7 @@ Here an example:
| :heavy_check_mark: **Okay** | <img width="125" alt="dig-class100_OK" src="https://user-images.githubusercontent.com/412645/199028380-7623776e-59b9-4356-ab55-3852253609df.png"> |
| :x: **Not** Okay | <img width="125" alt="dig-class100_NOK" src="https://user-images.githubusercontent.com/412645/199028469-3a69ed31-e5c9-4038-a8dc-6d44a42437ed.png"> |
### Analog Model Selection
Proceed the same way as with the Digit Model Selection.
### Saving
To save push `"Save`.
Once you are done, push `Save` to persist your setup.
A reboot is required to apply the changed configuration!

View File

@@ -4,82 +4,31 @@ After setting up the device (firmware, SD card, WLAN) the device will connect to
![](img/setup_initial_welcome.png){: style="width:500px"}
In the top you can navigate through 5 steps, that guide you through the necessary setup:
With the buttons on the top you can navigate through 5 steps which guide you through the necessary setup:
1. [Reference Image](Reference-Image.md)
1. [Alignment](Alignment.md)
1. [Digital ROIs](ROI-Configuration.md)
1. [Analog ROIs](ROI-Configuration.md) (Only required in case your meter has analoge pointers)
1. [General Settings](Configuration.md)
1. Create the [Reference Image](Reference-Image.md). It is the base for the position referencing and the identification of the digits and counters.
1. Define two unique [References](Alignment.md). It is used to align the individual camera images and identify the absolut positions.
1. Define the [Digital ROIs](ROI-Configuration.md) to be recognized. (Only required in case your meter has analoge pointers).
1. Define the [Analog ROIs](ROI-Configuration.md) to be identified</li>
1. [General Settings](Configuration.md). Most settings can be used with default value at the beginning.
All settings can be accessed also later in the normal operation mode.
!!! Note
Don' t forget to save each step with "Save" and do not reboot at this stage.
TODO rework
## 5. General Settings
In the next steps you can configure the behavior and external interfaces in detail:
![](img/initial_setup_5_configuration.jpg){: style="width:500px"}
The configuration is divided into different sub topics:
* TakeImage
* Digits
* Analog
* PostProcessing
* MQTT
* InfluxDB
* GPIO Settings
* Autotimer
* DataLogging
* Debug
* System
The details are explained in other parts of the manual (see links (**TBD**))
Some of the sections as well as parameters are mandatory. They can be en/disabled in the first column (1).
The setting itself is done in the next column (2) and a brief explanation you can find in the last column (3).
Don' t forget to save the settings with "Save" and do not reboot at this stage.
#### Expert Mode
With the normal parameters you should be able to make the needed settings for most of the system. Sometimes there is some fine tunning needed. For this there is an expert mode available. This can be enabled with the check box at the top (4). After this you see much more parameters. But before modifying them you should be really sure, what they are about.
## Finish Setup and change to normal operation
After setting up everything, there is a last step to be done:
## Finish the Setup and change to the Normal Operation mode
With the last step `(1)` you leave the **Setup Mode** and reboot to the **Normal Operation mode**.
![](img/initial_setup_6_finish_reboot.jpg){: style="width:500px"}
With (1) you leave the setup mode and reboot to normal operation mode.
## Access to setup in normal operation mode
You can access all the settings also during the normal working mode via the "Settings" menu:
## Access to the Setup Pages in the Normal Operation mode
You always can access all the settings during the normal operation mode via the `Settings` menu:
![](img/initial_setup_7_access_normal_mode.jpg){: style="width:500px"}
(1) Access to configuration parameters
(2) Update of reference image
(3) Update of alignment marks
(4)/(5) Update of the ROI setting
- `(1)` Access to the [General Settings](Configuration.md).
- `(2)` Update of the [Reference Image](Reference-Image.md).
- `(3)` Update of the [Alignment Marks](Alignment.md).
- `(4)/(5)` Update of the [ROIs](ROI-Configuration.md).