Skip to content

Commit 0cf1c72

Browse files
authored
Update readme to use ibpc (opencv#49)
* Update readme to use ibpc 0.0.3 is now on pip * Clean up ibpc_py README.md Signed-off-by: Tully Foote <[email protected]> * add forward references to the build instructions * restructure for clarity * tip about cuda * typos from internal review * fix list --------- Signed-off-by: Tully Foote <[email protected]>
1 parent 72ee234 commit 0cf1c72

File tree

2 files changed

+158
-28
lines changed

2 files changed

+158
-28
lines changed

README.md

Lines changed: 147 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,44 +49,183 @@ To simplify the evaluation process, Dockerfiles are provided to generate contain
4949

5050
Participants are expected to modify the estimator code to implement their solution. Once completed, your custom estimator should be containerized using Docker and submitted according to the challenge requirements. More detailed submission instructions will be provided soon.
5151

52-
## Requirements
52+
53+
## Validation Setup
54+
55+
### Requirements
5356

5457
- [Docker](https://docs.docker.com/)
55-
- [rocker](https://github.com/osrf/rocker)
58+
* Docker installed with their user in docker group for passwordless invocations.
59+
- 7z -- `apt install 7zip`
60+
- Python3 with virtualenv -- `apt install python3-virtualenv`
5661

5762
> Note: Participants are expected to submit Docker containers, so all development workflows are designed with this in mind.
5863
59-
## Setup
64+
65+
This section will guide you through validating your image.
66+
67+
#### Setup a workspace
68+
```
69+
mkdir -p ~/bpc_ws
70+
```
71+
72+
#### Create a virtual environment
73+
74+
📄 If you're already working in some form of virtualenv you can continue to use that and install `bpc` in that instead of making a new one.
75+
76+
```
77+
python3 -m venv ~/bpc_ws/bpc_env
78+
```
79+
80+
#### Activate that virtual env
81+
82+
```
83+
source ~/bpc_ws/bpc_env/bin/activate
84+
```
85+
86+
**For any new shell interacting with the `bpc` command you will have to rerun this source command.**
87+
88+
#### Install bpc
89+
```
90+
pip install ibpc
91+
```
92+
6093

6194

95+
### Fetch the dataset
96+
97+
```
98+
cd ~/bpc_ws
99+
bpc fetch ipd
100+
```
101+
102+
### Run the test
103+
104+
The test will validate your provided image against the test dataset.
105+
When you build a new image you rerun this test.
106+
107+
**At the moment the published tester is not available.
108+
You will have to build it locally see below in Development to build `ibpc:tester` and pass `--tester-image ibpc:tester` as additional arguments.
109+
The default is `ghcr.io/opencv/bpc/estimator-tester:latest` but that's currently unavailable.
110+
111+
```
112+
bpc test <POSE_ESTIMATOR_DOCKER_TAG> ipd
113+
```
114+
115+
For example:
116+
117+
```
118+
bpc test ghcr.io/opencv/bpc/estimator-example:latest ipd
119+
```
120+
**Substitute your own estimator image for ghcr.io/opencv/bpc/estimator-example:latest it's not currently available.**
121+
If you follow the development build below the argument is `ibpc:pose_estimator`.
122+
123+
The console output will show the system getting started and then the output of the estimator.
124+
125+
If you would like to interact with the estimator and run alternative commands or anything else in the container you can invoke it with `--debug`
126+
127+
The tester console output will be streamed to the file `ibpc_test_output.log` Use this to see it
128+
129+
```
130+
tail -f ibpc_test_output.log
131+
```
132+
133+
The results will come out as `submission.csv` when the tester is complete.
134+
135+
136+
## Pose Estimator Development
137+
138+
Above you've learned how to validate a system.
139+
It's time to learn how to create your own Pose Estimator.
140+
141+
### Fetch the source repository
142+
62143
```bash
63144
mkdir -p ~/ws_bpc/src
64145
cd ~/ws_bpc/src
65146
git clone https://github.com/opencv/bpc.git
66147
```
67148

68-
## Build
69-
70149
### Build the ibpc_pose_estimator
71150

151+
We will use the following example pose estimator for the demo.
152+
72153
```bash
73154
cd ~/ws_bpc/src/bpc
74-
docker buildx build -t ibpc:pose_estimator \
155+
docker buildx build -t bpc_pose_estimator:example \
75156
--file ./Dockerfile.estimator \
76157
--build-arg="MODEL_DIR=models" \
77158
.
78159
```
79160

161+
If you use this tag the `bpc` invocation will be as follows where you use the image you just built:
162+
163+
`bpc test bpc_pose_estimator:example ipd`
164+
165+
166+
👷 At this point it is up to you to fork and fill in the implementation of the pose estimator. 👷
167+
168+
### Tips
169+
170+
🐌 **If you are iterating a lot of times with the validation and are frustrated by how long the cuda installation is, you can add it to your Dockerfile as below.**
171+
It will make the image significantly larger, but faster to iterate if you put it higher in the dockerfile. We can't include it in the published image because the image gets too big for hosting and pulling easily.
172+
173+
```
174+
RUN apt-get update && apt-get install -y --no-install-recommends \
175+
wget software-properties-common gnupg2 \
176+
&& rm -rf /var/lib/apt/lists/*
177+
178+
RUN \
179+
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \
180+
dpkg -i cuda-keyring_1.1-1_all.deb && \
181+
rm cuda-keyring_1.1-1_all.deb && \
182+
\
183+
apt-get update && \
184+
apt-get -y install cuda-toolkit && \
185+
rm -rf /var/lib/apt/lists/*
186+
```
187+
188+
### Baseline Solution
189+
190+
We provide a simple baseline solution as a reference for implementing the solution in `ibpc_pose_estimator_py`. Please refer to the [baseline_solution](https://github.com/opencv/bpc/tree/baseline_solution) branch and follow the instructions there.
191+
192+
193+
## Further Details
194+
195+
The above is enough to get you going.
196+
However we want to be open about what else were doing.
197+
You can see the source of the tester and build your own version as follows if you'd like.
198+
80199
### Build the ibpc_tester
81200

201+
If you want to reproduce the tester image run the following command
202+
203+
204+
This is packaged and built via a github action to `ghcr.io/opencv/bpc/estimator-tester:latest` however this is how to reproduce it.
205+
82206
```bash
83207
cd ~/ws_bpc/src/bpc
84-
docker buildx build -t ibpc:tester \
208+
docker buildx build -t bpc_tester:latest \
85209
--file ./Dockerfile.tester \
86210
.
87211
```
88212

89-
## Run
213+
And then when you invoke `bpc test` append the argument `--tester-image bpc_tester:latest` to use your local build.
214+
215+
### If you would like the training data
216+
217+
Use the command:
218+
```
219+
bpc fetch ipd_all
220+
```
221+
222+
223+
### Manually Run components
224+
225+
It is possible to manually run the components.
226+
`bpc` shows what it is running on the console output.
227+
Or you can run as outlined below.
228+
90229

91230
### Start the Zenoh router
92231

@@ -108,10 +247,3 @@ rocker --nvidia --cuda --network=host ibpc:pose_estimator
108247
docker run --network=host -e BOP_PATH=/opt/ros/underlay/install/datasets -e SPLIT_TYPE=val -v<PATH_TO_DATASET>:/opt/ros/underlay/install/datasets -v<PATH_TO_OUTPUT_DIR>:/submission -it ibpc:tester
109248
```
110249

111-
## Baseline Solution
112-
113-
We provide a simple baseline solution as a reference for implementing the solution in `ibpc_pose_estimator_py`. Please refer to the [baseline_solution](https://github.com/opencv/bpc/tree/baseline_solution) branch and follow the instructions there.
114-
115-
## Next Steps
116-
117-
Stay tuned – more detailed submission instructions and guidelines will be provided soon.

ibpc_py/README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,26 @@
22

33
This is the python entrypoint for the Bin Picking Challenge
44

5-
## Usage
6-
7-
Get a dataset
8-
`bpc fetch lm`
9-
10-
11-
Run tests against a dataset
12-
`bpc test <Pose Estimator Image Name> <datasetname> `
13-
14-
`bpc test ibpc:pose_estimator lm`
5+
For example usage see the README at the root of this repository.
156

167

178
## Prerequisites
189

10+
- [Docker](https://docs.docker.com/)
11+
* Docker installed with their user in docker group for passwordless invocations.
12+
- 7z -- `apt install 7zip`
13+
- Python3 with virtualenv -- `apt install python3-virtualenv`
14+
1915

2016
### Install the package:
2117

22-
In a virtualenv
18+
In a virtualenv:
19+
2320
`pip install ibpc`
2421

25-
Temporary before rocker release of https://github.com/osrf/rocker/pull/317/
26-
`pip uninstall rocker && pip install git+http://github.com/osrf/rocker.git@console_to_file`
22+
Or to develop clone this and run:
23+
24+
`pip install -e .`
2725

2826

2927
### Nvidia Docker (optoinal)

0 commit comments

Comments
 (0)