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

Improve python utils #74

Merged
merged 35 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5eeb5ab
Renaming utility scripts
BAILOOL May 26, 2024
eb1604a
Create prod and dev requirements.txt
BAILOOL May 26, 2024
3beb89d
Applying isort and black
BAILOOL May 27, 2024
abbd28d
WIP
BAILOOL May 30, 2024
86eb686
Adding configs and scripts for linters test
BAILOOL Jun 5, 2024
812668d
Cleaning compute_error_statistic.py script
BAILOOL Jun 5, 2024
e952c18
WIP python utils
BAILOOL Jun 8, 2024
3bd8995
Cleaned all scripts
BAILOOL Jun 9, 2024
e39a12a
Dockerfile update
BAILOOL Jun 9, 2024
43ba44d
Run python linters in CI
BAILOOL Jun 9, 2024
9fbf3f2
Run python linters in CI
BAILOOL Jun 9, 2024
1a3780d
Condition to run after c++ builds
BAILOOL Jun 9, 2024
12963dd
Single script to run python utils
BAILOOL Jun 9, 2024
44c82b2
Imrpove README and contribution guide
BAILOOL Jun 9, 2024
b07a53e
Create results artifacts for blender sequences in CI
BAILOOL Jun 9, 2024
5cb881c
Debug CI
BAILOOL Jun 9, 2024
33b784c
Create artifact
BAILOOL Jun 9, 2024
9538dd2
Create artifact
BAILOOL Jun 9, 2024
6412573
Create artifact
BAILOOL Jun 9, 2024
8490eb4
Create artifact
BAILOOL Jun 9, 2024
9b4064f
Create artifact
BAILOOL Jun 9, 2024
e7793a6
Create artifact
BAILOOL Jun 9, 2024
c215ec6
Create artifact
BAILOOL Jun 9, 2024
b5dd089
Create artifact
BAILOOL Jun 9, 2024
e2c439e
Create artifact
BAILOOL Jun 9, 2024
c8549bf
Create artifact
BAILOOL Jun 10, 2024
31c305d
Create artifact
BAILOOL Jun 10, 2024
715367a
Create artifact
BAILOOL Jun 10, 2024
3e7d256
Create artifact
BAILOOL Jun 10, 2024
047d6d6
Create artifact
BAILOOL Jun 10, 2024
f6ae1e2
Create artifact
BAILOOL Jun 10, 2024
50f0509
Create artifact
BAILOOL Jun 10, 2024
3e8ec46
Create artifact
BAILOOL Jun 11, 2024
773ef21
Create artifact
BAILOOL Jun 11, 2024
5e28b01
Close figures once saved
BAILOOL Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 84 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug ..
run-clang-tidy



unit-tests-with-sanitizers:
if: ${{ false }} # TODO: disable for now until understand how to suppress leaks from external libraries like OpenCV
runs-on: ubuntu-latest
Expand Down Expand Up @@ -166,13 +166,44 @@ jobs:
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-prod:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
options: -v ${{ github.workspace }}:/home/MC-Calib:rw
run: |
mkdir MC-Calib/build && cd MC-Calib/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
./tests/boost_tests_run

- name: Collect results
run: |
cd ${{ github.workspace }}/data/Blender_Images
mkdir Results_Blender_Sequences

mkdir Results_Blender_Sequences/Scenario_1
cp -r Scenario_1/Results Results_Blender_Sequences/Scenario_1
cp Scenario_1/GroundTruth.yml Results_Blender_Sequences/Scenario_1

mkdir Results_Blender_Sequences/Scenario_2
cp -r Scenario_2/Results Results_Blender_Sequences/Scenario_2
cp Scenario_2/GroundTruth.yml Results_Blender_Sequences/Scenario_2

mkdir Results_Blender_Sequences/Scenario_3
cp -r Scenario_3/Results Results_Blender_Sequences/Scenario_3
cp Scenario_3/GroundTruth.yml Results_Blender_Sequences/Scenario_3

mkdir Results_Blender_Sequences/Scenario_4
cp -r Scenario_4/Results Results_Blender_Sequences/Scenario_4
cp Scenario_4/GroundTruth.yml Results_Blender_Sequences/Scenario_4

mkdir Results_Blender_Sequences/Scenario_5
cp -r Scenario_5/Results Results_Blender_Sequences/Scenario_5
cp Scenario_5/GroundTruth.yml Results_Blender_Sequences/Scenario_5

- name: Archive results artifacts
uses: actions/upload-artifact@v4
with:
name: results_blender_sequences
path: ${{ github.workspace }}/data/Blender_Images/Results_Blender_Sequences


code-coverage-testing:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -221,4 +252,54 @@ jobs:
minimum-coverage: 77
artifact-name: code-coverage-report-with-github-actions
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
update-comment: true


python-utils-linters:
runs-on: ubuntu-latest
needs:
- unit-tests-in-release-mode
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run python linters
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-dev:latest
options: -v ${{ github.workspace }}:/home/MC-Calib
run: |
cd MC-Calib/python_utils
./format.sh
./test.sh


python-utils:
runs-on: ubuntu-latest
needs:
- python-utils-linters
- unit-tests-in-release-mode
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download calibration results
uses: actions/download-artifact@v4
with:
name: results_blender_sequences
path: ${{ github.workspace }}/data

- name: Run python utils
uses: addnab/docker-run-action@v3
with:
image: bailool/mc-calib-prod:latest
options: -v ${{ github.workspace }}:/home/MC-Calib:rw
run: |
cd MC-Calib/python_utils
python3 post_calibration_analysis.py -d /home/MC-Calib/data/Scenario_1/Results/ /home/MC-Calib/data/Scenario_2/Results/ /home/MC-Calib/data/Scenario_3/Results/ /home/MC-Calib/data/Scenario_4/Results/ /home/MC-Calib/data/Scenario_5/Results/

- name: Archive results artifacts
uses: actions/upload-artifact@v4
with:
name: results_blender_sequences_with_python_utils
path: ${{ github.workspace }}/data
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y --no-install-recommends apt-utils && \
apt upgrade -y && apt autoremove -y && \
apt install -y build-essential cmake && \
apt install -y python-is-python3 python3-pip && \
rm -rf /var/lib/apt/lists/*

# suppress GTK warnings about accessibility because there's no dbus
Expand Down Expand Up @@ -36,6 +37,11 @@ RUN apt update && apt install -y git && \
cd /home && rm -rf ceres-solver" && \
rm -rf /var/lib/apt/lists/*

# Install python requirements for python_utils scripts
RUN --mount=type=bind,source=python_utils/requirements_prod.txt,target=/tmp/requirements.txt \
pip install --requirement /tmp/requirements.txt && \
rm -rf /var/lib/apt/lists/*

FROM prod as dev

RUN apt update && apt install -y python3-opencv && \
Expand All @@ -57,4 +63,9 @@ RUN apt update && apt install -y flex bison && \
# For development #
#------------------------------ #
RUN apt update && apt install -y cppcheck clang-tidy valgrind lcov && \
rm -rf /var/lib/apt/lists/*

# Install python requirements for python_utils scripts
RUN --mount=type=bind,source=python_utils/requirements_dev.txt,target=/tmp/requirements.txt \
pip install --requirement /tmp/requirements.txt && \
rm -rf /var/lib/apt/lists/*
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ There are several ways to get the environment ready. Choose any of them:
--volume="${PWD}:/home/MC-Calib" \
--volume="PATH_TO_DATA:/home/MC-Calib/data" \
bailool/mc-calib-prod
#xhost -local:root # resetting permissions
```

2. It is also possible to build the docker environment manually (see [instructions](/docs/Docker.md))
Expand Down Expand Up @@ -124,6 +123,12 @@ Documentation is available [online](https://codedocs.xyz/rameau-fr/MC-Calib/). T
./apps/calibrate/calibrate ../configs/calib_param.yml
```

8. **Run post-calibration analysis**

```bash
python3 python_utils/post_calibration_analysis.py -d save_path_from_calib_param.yml
```

## Calibration file

For multiple camera calibration configuration examples see `configs/*.yml`. For easier start, just duplicate the most relevant setup and fill with details.
Expand Down
11 changes: 10 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ Then, run the valgrind test:
./tests/boost_tests_run && make coverage


10. Create pull request.
10. Test python_utils scripts (if applicable)

.. code-block:: bash

cd python_utils
./format.sh
./test.sh


11. Create pull request.


Naming convention:
Expand Down
Loading
Loading