Skip to content

Commit 4c8c04c

Browse files
authored
Merge branch 'develop' into merge-master-into-develop
2 parents d8b1572 + f59deb6 commit 4c8c04c

26 files changed

+1195
-750
lines changed

Dockerfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM ubuntu:20.04
22

3-
ARG branch
3+
ARG branch=master
44

55
# Install dependencies
66
RUN apt-get update && \
7-
apt-get --yes install git sudo
8-
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
7+
apt-get --yes install git sudo && \
8+
DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
99

1010
# Add Tini
1111
ENV TINI_VERSION v0.19.0
@@ -16,12 +16,14 @@ ENTRYPOINT ["/tini", "--"]
1616
# Clone the repo and install the toolkit
1717
RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr -b $branch
1818
WORKDIR "/opendr"
19-
RUN ./bin/install.sh
19+
RUN ./bin/install.sh && \
20+
rm -rf /root/.cache/* && \
21+
apt-get clean
2022

2123
# Create script for starting Jupyter Notebook
22-
RUN /bin/bash -c "source ./bin/activate.sh; pip3 install jupyter"
23-
RUN echo "#!/bin/bash\n source ./bin/activate.sh\n ./venv/bin/jupyter notebook --port=8888 --no-browser --ip 0.0.0.0 --allow-root" > start.sh
24-
RUN chmod +x start.sh
24+
RUN /bin/bash -c "source ./bin/activate.sh; pip3 install jupyter" && \
25+
echo "#!/bin/bash\n source ./bin/activate.sh\n ./venv/bin/jupyter notebook --port=8888 --no-browser --ip 0.0.0.0 --allow-root" > start.sh && \
26+
chmod +x start.sh
2527

2628
# Start Jupyter Notebook inside OpenDR
2729
CMD ["./start.sh"]

Dockerfile-cuda

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
FROM nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04
22

3-
ARG branch
3+
ARG branch=develop
44

55
# Fix NVIDIA CUDA Linux repository key rotation
66
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
77
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu$(cat /etc/os-release | grep VERSION_ID | awk '{print substr($0,13,5)}' | awk -F'.' '{print $1$2}')/x86_64/3bf863cc.pub
88

9-
ARG branch
10-
11-
ARG branch
12-
139
# Install dependencies
1410
RUN apt-get update && \
15-
apt-get --yes install git sudo apt-utils
16-
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
11+
apt-get --yes install git sudo apt-utils && \
12+
DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
1713

1814
# Add Tini
1915
ENV TINI_VERSION v0.19.0
@@ -27,12 +23,14 @@ RUN sudo apt-get --yes install build-essential
2723
ENV OPENDR_DEVICE gpu
2824
RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr -b $branch
2925
WORKDIR "/opendr"
30-
RUN ./bin/install.sh
26+
RUN ./bin/install.sh && \
27+
rm -rf /root/.cache/* && \
28+
apt-get clean
3129

3230
# Create script for starting Jupyter Notebook
33-
RUN /bin/bash -c "source ./bin/activate.sh; pip3 install jupyter"
34-
RUN echo "#!/bin/bash\n source ./bin/activate.sh\n ./venv/bin/jupyter notebook --port=8888 --no-browser --ip 0.0.0.0 --allow-root" > start.sh
35-
RUN chmod +x start.sh
31+
RUN /bin/bash -c "source ./bin/activate.sh; pip3 install jupyter" && \
32+
echo "#!/bin/bash\n source ./bin/activate.sh\n ./venv/bin/jupyter notebook --port=8888 --no-browser --ip 0.0.0.0 --allow-root" > start.sh && \
33+
chmod +x start.sh
3634

3735
# Start Jupyter Notebook inside OpenDR
3836
CMD ["./start.sh"]

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ______________________________________________________________________
1111
<a href="docs/reference/installation.md">Installation</a> •
1212
<a href="#using-opendr-toolkit">Using OpenDR toolkit</a> •
1313
<a href="projects">Examples</a> •
14+
<a href="docs/reference/customize.md">Customization</a> •
1415
<a href="#roadmap">Roadmap</a> •
1516
<a href="CHANGELOG.md">Changelog</a> •
1617
<a href="LICENSE">License</a>
@@ -59,10 +60,10 @@ Please follow the instructions provided in the [wiki](https://github.com/tasoste
5960
## How to cite us
6061
If you use OpenDR for your research, please cite the following paper that introduces OpenDR architecture and design:
6162
<pre>
62-
@article{opendr2022,
63+
@inproceedings{opendr2022,
6364
title={OpenDR: An Open Toolkit for Enabling High Performance, Low Footprint Deep Learning for Robotics},
6465
author={Passalis, Nikolaos and Pedrazzi, Stefania and Babuska, Robert and Burgard, Wolfram and Dias, Daniel and Ferro, Francesco and Gabbouj, Moncef and Green, Ole and Iosifidis, Alexandros and Kayacan, Erdal and Kober, Jens and Michel, Olivier and Nikolaidis, Nikos and Nousi, Paraskevi and Pieters, Roel and Tzelepi, Maria and Valada, Abhinav and Tefas, Anastasios},
65-
journal={arXiv preprint arXiv:2203.00403},
66+
booktitle = {Proceedings of the 2022 IEEE/RSJ International Conference on Intelligent Robots and Systems (to appear)},
6667
year={2022}
6768
}
6869
</pre>

docs/reference/customize.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Customizing the toolkit
2+
3+
OpenDR is fully open-source and can be readily customized to meet the needs of several different application areas, since the source code for all the developed tools is provided.
4+
Several ready-to-use examples, which are expected to cover a wide range of different needs, are provided.
5+
For example, users can readily use the existing [ROS nodes](projects/opendr_ws), e.g., by including the required triggers or by combining several nodes into one to build custom nodes that will fit their needs.
6+
Furthermore, note that several tools can be combined within a ROS node, as showcased in [face recognition ROS node](projects/opendr_ws/src/perception/scripts/face_recognition.py).
7+
You can use these nodes as a template for customizing the toolkit to your own needs.
8+
The rest of this document includes instructions for:
9+
1. Building docker images using the provided docker files.
10+
11+
12+
## Building custom docker images
13+
The default docker images can be too large for some applications.
14+
OpenDR provides the dockerfiles for customizing the images to your own needs, e.g., using OpenDR in custom third-party images.
15+
Therefore, you can build the docker images locally using the [Dockerfile](/Dockerfile) ([Dockerfile-cuda](/Dockerfile-cuda) for cuda) provided in the root folder of the toolkit.
16+
17+
### Building the CPU image
18+
For the CPU image, execute the following commands:
19+
```bash
20+
git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr
21+
cd opendr
22+
sudo docker build -t opendr/opendr-toolkit:cpu .
23+
```
24+
25+
### Building the CUDA image
26+
For the cuda-enabled image, first edit `/etc/docker/daemon.json` in order to set the default docker runtime:
27+
```
28+
{
29+
"runtimes": {
30+
"nvidia": {
31+
"path": "nvidia-container-runtime",
32+
"runtimeArgs": []
33+
}
34+
},
35+
"default-runtime": "nvidia"
36+
}
37+
```
38+
39+
Restart docker afterwards:
40+
```
41+
sudo systemctl restart docker.service
42+
```
43+
Then you can build the supplied dockerfile:
44+
```bash
45+
git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr
46+
cd opendr
47+
sudo docker build -t opendr/opendr-toolkit:cuda -f Dockerfile-cuda .
48+
```
49+
50+
### Running the custom images
51+
In order to run them, the commands are respectively:
52+
```bash
53+
sudo docker run -p 8888:8888 opendr/opendr-toolkit:cpu
54+
```
55+
and
56+
```
57+
sudo docker run --gpus all -p 8888:8888 opendr/opendr-toolkit:cuda
58+
```

docs/reference/fall-detection.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ The *fall_detection* module contains the *FallDetectorLearner* class, which inhe
55
### Class FallDetectorLearner
66
Bases: `engine.learners.Learner`
77

8-
The *FallDetectorLearner* class contains the implementation of a naive fall detector algorithm.
8+
The *FallDetectorLearner* class contains the implementation of a rule-based fall detector algorithm.
99
It can be used to perform fall detection on images (inference) using a pose estimator.
1010

11+
This rule-based method can provide **cheap and fast** fall detection capabilities when pose estimation
12+
is already being used. Its inference time cost is ~0.1% of pose estimation, adding negligible overhead.
13+
14+
However, it **has known limitations** due to its nature. Working with 2D poses means that depending on the
15+
orientation of the person, it cannot detect most fallen poses that face the camera.
16+
Another example of known false-positive detection occurs when a person is sitting with their knees
17+
detectable, but ankles obscured or undetectable, this however is critical for detecting a fallen person
18+
whose ankles are not visible.
19+
1120
The [FallDetectorLearner](/src/opendr/perception/fall_detection/fall_detector_learner.py) class has the
1221
following public methods:
1322

docs/reference/installation.md

+54-84
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,29 @@
11
# Installing OpenDR toolkit
22

33
OpenDR can be installed in the following ways:
4-
1. By cloning this repository (CPU/GPU support)
5-
2. Using *pip* (CPU/GPU support)
6-
3. Using *docker* (CPU/GPU support)
4+
1. Using *pip* (CPU/GPU support)
5+
2. Using *docker* (CPU/GPU support)
6+
3. By cloning this repository (CPU/GPU support, for advanced users only)
77

88
The following table summarizes the installation options based on your system architecture and OS:
99

10-
| Installation Method | CPU/GPU | OS |
11-
|---------------------|----------|-----------------------|
12-
| Clone & Install | Both | Ubuntu 20.04 (x86-64) |
13-
| pip | Both | Ubuntu 20.04 (x86-64) |
14-
| docker | Both | Linux / Windows |
10+
| Installation Method | OS |
11+
|-----------------------|-----------------------|
12+
| Clone & Install | Ubuntu 20.04 (x86-64) |
13+
| pip | Ubuntu 20.04 (x86-64) |
14+
| docker | Linux / Windows |
1515

16+
Note that pip installation includes only the Python API of the toolkit.
17+
If you need to use all the functionalities of the toolkit (e.g., ROS nodes, etc.), then you need either to use the pre-compiled docker images or to follow the installation instructions for cloning and building the toolkit.
1618

17-
# Installing by cloning OpenDR repository (Ubuntu 20.04, x86, architecture)
18-
19-
This is the recommended way of installing the whole toolkit, since it allows for fully exploiting all the provided functionalities.
20-
To install the toolkit, please first make sure that you have `git` available on your system.
21-
```bash
22-
sudo apt install git
23-
```
24-
Then, clone the toolkit:
25-
```bash
26-
git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr
27-
```
28-
You are then ready to install the toolkit:
29-
```bash
30-
cd opendr
31-
./bin/install.sh
32-
```
33-
The installation script automatically installs all the required dependencies.
34-
Note that this might take a while (~10-20min depending on your machine and network connection), while the script also makes system-wide changes.
35-
Using dockerfiles is strongly advised (please see below), unless you know what you are doing.
36-
Please also make sure that you have enough RAM available for the installation (about 4GB of free RAM is needed for the full installation/compilation).
37-
38-
39-
If you want to install GPU-related dependencies, then you can appropriately set the `OPENDR_DEVICE` variable.
40-
The toolkit defaults to using CPU.
41-
Therefore, if you want to use GPU, please set this variable accordingly *before* running the installation script:
42-
```bash
43-
export OPENDR_DEVICE=gpu
44-
```
45-
The installation script creates a *virtualenv*, where the toolkit is installed.
46-
To activate OpenDR environment you can just source the `activate.sh`:
19+
The toolkit is developed and tested on *Ubuntu 20.04 (x86-64)*.
20+
Please make sure that you have the most recent version of all tools by running
4721
```bash
48-
source ./bin/activate.sh
22+
sudo apt upgrade
4923
```
50-
Then, you are ready to use the toolkit!
51-
52-
**NOTE:** `OPENDR_DEVICE` does not alter the inference/training device at *runtime*.
53-
It only affects the dependency installation.
54-
You can use OpenDR API to change the inference device.
55-
56-
You can also verify the installation by using the supplied Python and C unit tests:
57-
```bash
58-
make unittest
59-
make ctests
60-
```
61-
62-
If you plan to use GPU-enabled functionalities, then you are advised to install [CUDA 11.2](https://developer.nvidia.com/cuda-11.2.0-download-archive), along with [CuDNN](https://developer.nvidia.com/cudnn).
63-
64-
**HINT:** All tests probe for the `TEST_DEVICE` enviromental variable when running.
65-
If this enviromental variable is set during testing, it allows for easily running all tests on a different device (e.g., setting `TEST_DEVICE=cuda:0` runs all tests on the first GPU of the system).
24+
before installing the toolkit and then follow the installation instructions in the relevant section.
25+
All the required dependencies will be automatically installed (or explicit instructions are provided).
26+
Other platforms apart from Ubuntu 20.04, e.g., Windows, other Linux distributions, etc., are currently supported through docker images.
6627

6728
# Installing using *pip*
6829

@@ -179,45 +140,54 @@ In this case, do not forget to enable the virtual environment with:
179140
```bash
180141
source bin/activate.sh
181142
```
182-
## Build the docker images yourself _(optional)_
183-
Alternatively you can also build the docker images locally using the [Dockerfile](/Dockerfile) ([Dockerfile-cuda](/Dockerfile-cuda) for cuda) provided in the root folder of the toolkit.
184143

185-
For the CPU image, execute the following commands:
144+
# Installing by cloning OpenDR repository (Ubuntu 20.04, x86, architecture)
145+
146+
This is the recommended way of installing the whole toolkit, since it allows for fully exploiting all the provided functionalities.
147+
To install the toolkit, please first make sure that you have `git` available on your system.
148+
```bash
149+
sudo apt install git
150+
```
151+
Then, clone the toolkit:
186152
```bash
187153
git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr
154+
```
155+
You are then ready to install the toolkit:
156+
```bash
188157
cd opendr
189-
sudo docker build -t opendr/opendr-toolkit:cpu .
158+
./bin/install.sh
190159
```
160+
The installation script automatically installs all the required dependencies.
161+
Note that this might take a while (~10-20min depending on your machine and network connection), while the script also makes system-wide changes.
162+
Using dockerfiles is strongly advised (please see below), unless you know what you are doing.
163+
Please also make sure that you have enough RAM available for the installation (about 4GB of free RAM is needed for the full installation/compilation).
191164

192-
For the cuda-enabled image, first edit `/etc/docker/daemon.json` in order to set the default docker runtime:
193-
```
194-
{
195-
"runtimes": {
196-
"nvidia": {
197-
"path": "nvidia-container-runtime",
198-
"runtimeArgs": []
199-
}
200-
},
201-
"default-runtime": "nvidia"
202-
}
203-
```
204165

205-
Restart docker afterwards:
206-
```
207-
sudo systemctl restart docker.service
166+
If you want to install GPU-related dependencies, then you can appropriately set the `OPENDR_DEVICE` variable.
167+
The toolkit defaults to using CPU.
168+
Therefore, if you want to use GPU, please set this variable accordingly *before* running the installation script:
169+
```bash
170+
export OPENDR_DEVICE=gpu
208171
```
209-
Then you can build the supplied dockerfile:
172+
The installation script creates a *virtualenv*, where the toolkit is installed.
173+
To activate OpenDR environment you can just source the `activate.sh`:
210174
```bash
211-
git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr
212-
cd opendr
213-
sudo docker build -t opendr/opendr-toolkit:cuda -f Dockerfile-cuda .
175+
source ./bin/activate.sh
214176
```
177+
Then, you are ready to use the toolkit!
178+
179+
**NOTE:** `OPENDR_DEVICE` does not alter the inference/training device at *runtime*.
180+
It only affects the dependency installation.
181+
You can use OpenDR API to change the inference device.
215182

216-
In order to run them, the commands are respectively:
183+
You can also verify the installation by using the supplied Python and C unit tests:
217184
```bash
218-
sudo docker run --gpus all -p 8888:8888 opendr/opendr-toolkit:cpu
219-
```
220-
and
221-
```
222-
sudo docker run --gpus all -p 8888:8888 opendr/opendr-toolkit:cuda
185+
make unittest
186+
make ctests
223187
```
188+
189+
If you plan to use GPU-enabled functionalities, then you are advised to install [CUDA 11.2](https://developer.nvidia.com/cuda-11.2.0-download-archive), along with [CuDNN](https://developer.nvidia.com/cudnn).
190+
191+
**HINT:** All tests probe for the `TEST_DEVICE` enviromental variable when running.
192+
If this enviromental variable is set during testing, it allows for easily running all tests on a different device (e.g., setting `TEST_DEVICE=cuda:0` runs all tests on the first GPU of the system).
193+

docs/reference/rosbridge.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,28 @@ ROSBridge.from_ros_pose(self,
5959
ros_pose)
6060
```
6161

62-
Converts a ROS pose into an OpenDR pose.
62+
Converts an OpenDRPose2D message into an OpenDR Pose.
6363

6464
Parameters:
6565

66-
- **message**: *ros_bridge.msg.Pose*\
67-
ROS pose to be converted into an OpenDR pose.
66+
- **ros_pose**: *ros_bridge.msg.OpenDRPose2D*\
67+
ROS pose to be converted into an OpenDR Pose.
6868

6969
#### `ROSBridge.to_ros_pose`
7070

7171
```python
7272
ROSBridge.to_ros_pose(self,
73-
ros_pose)
73+
pose)
7474
```
75-
Converts an OpenDR pose into a ROS pose.
75+
Converts an OpenDR Pose into a OpenDRPose2D msg that can carry the same information, i.e. a list of keypoints,
76+
the pose detection confidence and the pose id.
77+
Each keypoint is represented as an OpenDRPose2DKeypoint with x, y pixel position on input image with (0, 0)
78+
being the top-left corner.
7679

7780
Parameters:
7881

79-
- **message**: *engine.target.Pose*\
80-
OpenDR pose to be converted to ROS pose.
82+
- **pose**: *engine.target.Pose*\
83+
OpenDR Pose to be converted to ROS OpenDRPose2D.
8184

8285

8386
#### `ROSBridge.to_ros_category`

0 commit comments

Comments
 (0)