Read-only mirror of https://github.com/ethz-asl/analog_gauge_reader — ETHZ ASL. Issues & pull requests at the source.
  • Python 72.4%
  • Jupyter Notebook 25.8%
  • Shell 1.4%
  • CMake 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
mauritsreitsma 518cdfaab1
Cleanup path names (#21)
Cleanup path names
2024-05-13 14:31:39 +02:00
angle_reading_fit Implement RANSAC for reading 2023-05-30 13:26:08 +02:00
dependencies Add models and dependencies via LFS 2023-06-19 15:54:37 +02:00
evaluation Merge pull request #13 from ethz-asl/feature/rotations_pipeline 2023-07-27 16:55:21 +02:00
gauge_detection Add ROS node 2023-07-27 19:01:05 +02:00
geometry Cleanup path names (#21) 2024-05-13 14:31:39 +02:00
key_point_detection Cleanup names 2023-06-28 13:45:43 +02:00
launch Add ROS node 2023-07-27 19:01:05 +02:00
models Add models and dependencies via LFS 2023-06-19 15:54:37 +02:00
msg Add ROS node 2023-07-27 19:01:05 +02:00
ocr Cleanup path names (#21) 2024-05-13 14:31:39 +02:00
scripts Add ROS node 2023-07-27 19:01:05 +02:00
segmentation Add Poetry package manager support 2023-06-19 15:41:08 +02:00
srv Add ROS node 2023-07-27 19:01:05 +02:00
.gitattributes Add models and dependencies via LFS 2023-06-19 15:54:37 +02:00
.gitignore Modify .gitignore: Add .vscode ignore 2023-04-24 10:06:30 +02:00
.pre-commit-config.yaml remove markdownlint from pre-commit 2023-03-03 13:40:10 +01:00
.pylintrc Get BBox data for full evaluation 2023-05-16 20:14:18 +02:00
CMakeLists.txt Add ROS node 2023-07-27 19:01:05 +02:00
evaluations.sh Cleanup names 2023-06-28 13:45:43 +02:00
experiments.sh Cleanup names 2023-06-28 13:45:43 +02:00
full_evaluations.sh Cleanup names 2023-06-28 13:45:43 +02:00
LICENSE.md Add LICENSE.md 2023-06-19 15:46:14 +02:00
method_overview.png Add method overview 2024-05-13 13:51:32 +02:00
package.xml Add ROS node 2023-07-27 19:01:05 +02:00
pipeline.py Add ROS node 2023-07-27 19:01:05 +02:00
plots.py Add warp ocr without rotation 2023-06-14 19:45:49 +02:00
poetry.lock Add Poetry package manager support 2023-06-19 15:41:08 +02:00
pyproject.toml Add ROS node 2023-07-27 19:01:05 +02:00
README.md Update README.md 2024-05-13 14:10:31 +02:00
ros_node.py Improve inference speed massively when using ROS 2023-08-04 17:46:09 +02:00
setup.py Add ROS node 2023-07-27 19:01:05 +02:00

analog_gauge_reader

This is the code for the paper Under Pressure: Learning-Based Analog Gauge Reading In The Wild by Maurits Reitsma, Julian Keller, Kenneth Blomqvist and Roland Siegwart.

Setup installation (Poetry, automatic)

Install Poetry

curl -sSL https://install.python-poetry.org | python3 -

Install the project dependencies

poetry install

Enter Poetry shell

poetry shell

Setup installation (manual)

To setup the conda environment to run all scripts follow the following instruction:

Install miniconda

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh

Activate conda environment

conda create --name gauge_reader python=3.8 -y
conda activate gauge_reader

install pytorch

We use torch version 2.0.0.

conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 -c pytorch -c nvidia

install mmocr

Refer to this page for installation https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html We use the version dev-1.x

pip install -U openmim
mim install mmengine==0.7.2
mim install mmcv==2.0.0
mim install mmdet==3.0.0
mim install mmocr==1.0.0

We use the following versions: mmocr 1.0.0, mmdet 3.0.0, mmcv 2.0.0, mmengine 0.7.2. If for some reason the installation fails refer to https://github.com/open-mmlab/mmcv/issues/2938. We found that it is essential that we have Pytorch version 2.0.0

install yolov8

We use ultralytics version 8.0.66

pip install ultralytics

install sklearn

We use scikit-learn version 1.2.2

pip install -U scikit-learn

Run pipeline script

The pipeline script can be run with the following command:

python pipeline.py --detection_model path/to/detection_model --segmentation_model /path/to/segmentation_model --key_point_model path/to/key_point_model --base_path path/to/results --input path/to/test_image_folder/images --debug --eval

For the input you can either choose an entire folder of images or a single image. Both times the result will be saved to a new run folder created in the base_path folder. For each image in the input folder a separate folder will be created.

In each such folder the reading is stored inside the result.json file. If there is no such reading, one of the pipeline stages failed before a reading could be computed. Best check the log file which is saved inside the run folder, to see where the error came up. There will also be a error.json file saved to the image folder, which computes some metrics to check without any labels how good our estimate is.

Additionally if the debug flag is set then the plots of all pipeline stages will be added to this folder. If the eval flag is set then there will also be a result_full.json file created. This file contains the data of the individual stages of the pipeline, which is used when evaluating in the script full_evaluation.py.

Run experiments

I prepared two scripts to automatically run the pipeline and evaluations on multiple folders with one command. This allows us to easily conduct experiments for images that we group by their characteristics in different folders.

If they want to be used, make sure to modify the paths inside the scripts, to match with your data.