Dark theme only with webcam (#65)
* Only dark theme with webcam * Fixed axes colors * Update printer.py * Fixed axes in printer.py * Fixed test images names * Fixed README * Fixed README * Fixed bird view * Linting * Linting
6
.github/workflows/tests.yml
vendored
@ -10,14 +10,16 @@ on:
|
||||
paths:
|
||||
- 'monoloco/**'
|
||||
- 'test/**'
|
||||
- 'docs/test*'
|
||||
- 'docs/00*.png'
|
||||
- 'docs/frame0032.jpg'
|
||||
- '.github/workflows/tests.yml'
|
||||
|
||||
pull_request:
|
||||
paths:
|
||||
- 'monoloco/**'
|
||||
- 'test/**'
|
||||
- 'docs/test*'
|
||||
- 'docs/00*.png'
|
||||
- 'docs/frame0032.jpg'
|
||||
- '.github/workflows/tests.yml'
|
||||
|
||||
jobs:
|
||||
|
||||
20
README.md
@ -17,7 +17,7 @@ This library is based on three research projects for monocular/stereo 3D human l
|
||||
[T. Mordan](https://people.epfl.ch/taylor.mordan/?lang=en), [A. Alahi](https://scholar.google.com/citations?user=UIhXQ64AAAAJ&hl=en)_, ICRA 2021 <br />
|
||||
__[Article](https://arxiv.org/abs/2008.10913)__ __[Citation](#Citation)__ __[Video](https://www.youtube.com/watch?v=pGssROjckHU)__
|
||||
|
||||
<img src="docs/out_test_000840_multi.jpg" width="700"/>
|
||||
<img src="docs/out_000840_multi.jpg" width="700"/>
|
||||
|
||||
---
|
||||
|
||||
@ -125,24 +125,24 @@ If you provide a ground-truth json file to compare the predictions of the networ
|
||||
For an example image, run the following command:
|
||||
|
||||
```sh
|
||||
python3 -m monoloco.run predict docs/test_002282.png \
|
||||
python3 -m monoloco.run predict docs/002282.png \
|
||||
--path_gt names-kitti-200615-1022.json \
|
||||
-o <output directory> \
|
||||
--long-edge <rescale the image by providing dimension of long side>
|
||||
--n_dropout <50 to include epistemic uncertainty, 0 otherwise>
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
To show all the instances estimated by MonoLoco add the argument `--show_all` to the above command.
|
||||
|
||||

|
||||

|
||||
|
||||
It is also possible to run [openpifpaf](https://github.com/vita-epfl/openpifpaf) directly
|
||||
by using `--mode keypoints`. All the other pifpaf arguments are also supported
|
||||
and can be checked with `python3 -m monoloco.run predict --help`.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
**Stereo Examples** <br />
|
||||
@ -156,12 +156,12 @@ You can load one or more image pairs using glob expressions. For example:
|
||||
|
||||
```sh
|
||||
python3 -m monoloco.run predict --mode stereo \
|
||||
--glob docs/test_000840*.png
|
||||
--glob docs/000840*.png
|
||||
--path_gt <to match results with ground-truths> \
|
||||
-o data/output -long_edge 2500
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
```sh
|
||||
python3 -m monoloco.run predict --glob docs/005523*.png \ --output_types multi \
|
||||
@ -183,7 +183,7 @@ For more info, run:
|
||||
**Examples** <br>
|
||||
An example from the Collective Activity Dataset is provided below.
|
||||
|
||||
<img src="docs/test_frame0032.jpg" width="500"/>
|
||||
<img src="docs/frame0032.jpg" width="500"/>
|
||||
|
||||
To visualize social distancing run the below, command:
|
||||
|
||||
@ -192,11 +192,11 @@ pip3 install scipy
|
||||
```
|
||||
|
||||
```sh
|
||||
python3 -m monoloco.run predict docs/test_frame0032.jpg \
|
||||
python3 -m monoloco.run predict docs/frame0032.jpg \
|
||||
--activities social_distance --output_types front bird
|
||||
```
|
||||
|
||||
<img src="docs/out_test_frame0032_front_bird.jpg" width="700"/>
|
||||
<img src="docs/out_frame0032_front_bird.jpg" width="700"/>
|
||||
|
||||
## C) Hand-raising detection
|
||||
To detect raised hand, you can add the argument `--activities raise_hand` to the prediction command.
|
||||
|
||||
|
Before Width: | Height: | Size: 736 KiB After Width: | Height: | Size: 736 KiB |
|
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 732 KiB |
|
Before Width: | Height: | Size: 831 KiB After Width: | Height: | Size: 831 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 633 KiB After Width: | Height: | Size: 633 KiB |
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 398 KiB |
|
Before Width: | Height: | Size: 411 KiB After Width: | Height: | Size: 411 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 138 KiB |
@ -114,7 +114,8 @@ class Printer:
|
||||
def factory_axes(self, dic_out):
|
||||
"""Create axes for figures: front bird multi"""
|
||||
|
||||
plt.style.use('dark_background')
|
||||
if self.webcam:
|
||||
plt.style.use('dark_background')
|
||||
|
||||
axes = []
|
||||
figures = []
|
||||
@ -217,7 +218,8 @@ class Printer:
|
||||
def _bird_loop(self, iterator, axes, colors, number):
|
||||
for idx in iterator:
|
||||
if any(xx in self.output_types for xx in ['bird', 'multi']) and self.zz_pred[idx] > 0:
|
||||
draw_orientation(axes[1], self.xz_centers, [], self.angles, colors, mode='bird')
|
||||
draw_orientation(axes[1], self.xz_centers[:len(iterator)], [],
|
||||
self.angles[:len(iterator)], colors, mode='bird')
|
||||
# Draw ground truth and uncertainty
|
||||
self._draw_uncertainty(axes, idx)
|
||||
|
||||
@ -424,17 +426,19 @@ class Printer:
|
||||
ax.get_yaxis().set_visible(False)
|
||||
|
||||
else:
|
||||
line_style = 'w--' if self.webcam else 'k--'
|
||||
uv_max = [0., float(self.height)]
|
||||
xyz_max = pixel_to_camera(uv_max, self.kk, self.z_max)
|
||||
x_max = abs(xyz_max[0]) # shortcut to avoid oval circles in case of different kk
|
||||
corr = round(float(x_max / 3))
|
||||
ax.plot([0, x_max], [0, self.z_max], 'w--')
|
||||
ax.plot([0, -x_max], [0, self.z_max], 'w--')
|
||||
ax.plot([0, x_max], [0, self.z_max], line_style)
|
||||
ax.plot([0, -x_max], [0, self.z_max], line_style)
|
||||
ax.set_xlim(-x_max + corr, x_max - corr)
|
||||
ax.set_ylim(0, self.z_max + 1)
|
||||
ax.set_xlabel("X [m]")
|
||||
ax.set_box_aspect(.8)
|
||||
plt.xlim((-x_max, x_max))
|
||||
if self.webcam:
|
||||
ax.set_box_aspect(.8)
|
||||
plt.xlim((-x_max, x_max))
|
||||
plt.xticks(fontsize=self.attr['fontsize_ax'])
|
||||
plt.yticks(fontsize=self.attr['fontsize_ax'])
|
||||
return ax
|
||||
|
||||
@ -24,7 +24,7 @@ TRAIN_COMMAND = [
|
||||
PREDICT_COMMAND = [
|
||||
'python3', '-m', 'monoloco.run',
|
||||
'predict',
|
||||
'docs/test_002282.png',
|
||||
'docs/002282.png',
|
||||
'--output_types', 'multi', 'json',
|
||||
'--decoder-workers=0' # for windows
|
||||
]
|
||||
@ -32,7 +32,7 @@ PREDICT_COMMAND = [
|
||||
PREDICT_COMMAND_SOCIAL_DISTANCE = [
|
||||
'python3', '-m', 'monoloco.run',
|
||||
'predict',
|
||||
'docs/test_frame0032.jpg',
|
||||
'docs/frame0032.jpg',
|
||||
'--activities', 'social_distance',
|
||||
'--output_types', 'front', 'bird',
|
||||
'--decoder-workers=0' # for windows'
|
||||
@ -64,8 +64,8 @@ def test_train_mono(tmp_path):
|
||||
print(' '.join(predict_cmd))
|
||||
subprocess.run(predict_cmd, check=True, capture_output=True)
|
||||
print(os.listdir(tmp_path))
|
||||
assert 'out_test_002282.png.multi.png' in os.listdir(tmp_path)
|
||||
assert 'out_test_002282.png.monoloco.json' in os.listdir(tmp_path)
|
||||
assert 'out_002282.png.multi.png' in os.listdir(tmp_path)
|
||||
assert 'out_002282.png.monoloco.json' in os.listdir(tmp_path)
|
||||
|
||||
predict_cmd_sd = PREDICT_COMMAND_SOCIAL_DISTANCE + [
|
||||
'--model={}'.format(model),
|
||||
@ -75,5 +75,5 @@ def test_train_mono(tmp_path):
|
||||
print(' '.join(predict_cmd_sd))
|
||||
subprocess.run(predict_cmd_sd, check=True, capture_output=True)
|
||||
print(os.listdir(tmp_path))
|
||||
assert 'out_test_frame0032.jpg.front.png' in os.listdir(tmp_path)
|
||||
assert 'out_test_frame0032.jpg.bird.png' in os.listdir(tmp_path)
|
||||
assert 'out_frame0032.jpg.front.png' in os.listdir(tmp_path)
|
||||
assert 'out_frame0032.jpg.bird.png' in os.listdir(tmp_path)
|
||||
|
||||
@ -26,7 +26,7 @@ PREDICT_COMMAND = [
|
||||
'python3', '-m', 'monoloco.run',
|
||||
'predict',
|
||||
'--mode=stereo',
|
||||
'--glob', 'docs/test_000840*.png',
|
||||
'--glob', 'docs/000840*.png',
|
||||
'--output_types', 'multi', 'json',
|
||||
'--decoder-workers=0', # for windows'
|
||||
]
|
||||
@ -56,4 +56,4 @@ def test_train_stereo(tmp_path):
|
||||
print(' '.join(predict_cmd))
|
||||
subprocess.run(predict_cmd, check=True, capture_output=True)
|
||||
print(os.listdir(tmp_path))
|
||||
assert 'out_test_000840.png.multi.png' in os.listdir(tmp_path)
|
||||
assert 'out_000840.png.multi.png' in os.listdir(tmp_path)
|
||||
|
||||