Skip to content

Commit

Permalink
Tennis table dataset (#29)
Browse files Browse the repository at this point in the history
* feat: added datasets via DVC

feat: added new parser from binary .out file to raw png

* fix: minor codestyle

* feat: added dataset for 2ms exposure

* feat: added sorted frames json files for orange dark 2ms frames

* feat: sorted dataset orange 2ms

* feat: stats for frames in dataset

* fix: replaced annotation

* feat: segmentation masks for dataset

* feat: added recorded parameters to dataset

* fix: yaml codestyle

* feat: annotated datasets

---------

Co-authored-by: Daniel Paleyev <danny.paleyev@gmail.com>
Co-authored-by: Denis Bakin <denis.bakin@gmail.com>
  • Loading branch information
3 people committed May 4, 2024
1 parent bdc53cf commit 784c41e
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 0 deletions.
43 changes: 43 additions & 0 deletions datasets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Information about datasets

## TableMulticolorRecord_19_04

| | |
| --- | --- |
| Date | 19.04.2024 |
| Location | Table tennis club HSE |
| Setup | 2 cameras across the one side of the table, ~90 degress axis intersection |
| Calibration available | No |
| Annotation | \<ball-color>\_<light/dark>\_\<exposure> |

### Available sets
- 6ms exposure
- With additional light (from camera ID=2)
- green
- orange
- white
- No additional light
- green
- orange
- white


## TableOrange2msRecord_22_04

| | |
| --- | --- |
| Date | 22.04.2024 |
| Location | Table tennis club HSE |
| Setup | 2 cameras across the one side of the table, ~90 degress axis intersection |
| Calibration available | Yes (intrinsics + stereo) |
| Annotation | \<ball-color>\_<light/dark>\_\<exposure> |

### Available sets
- 2ms exposure
- With additional light (from camera ID=2)
- orange
- No additional light
- orange
- calibration boards
- aruco board (GridBoard, 5x7 cells, 60mm marker, 30mm gap, DICT_5X5_250)
- charuco board (CharucoBoard, 7x10 cells, 60mm cell, 40mm marker, DICT_5X5_250)
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/green_dark_6ms
/green_light_6ms
/orange_dark_6ms
/orange_light_6ms
/white_light_6ms
/white_dark_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/green_dark_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: a931100ed10f3117ccde87999550b6c9.dir
size: 8261648570
nfiles: 6000
hash: md5
path: green_dark_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/green_light_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 90b646460cabb3129a4460637c474d15.dir
size: 11967419975
nfiles: 8000
hash: md5
path: green_light_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/orange_dark_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 942ea6de714878c631b4b3cdf1ffff26.dir
size: 8262419969
nfiles: 6000
hash: md5
path: orange_dark_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/orange_light_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 4067b7966c1eff87056fe72ab50e4bb2.dir
size: 11803559470
nfiles: 8000
hash: md5
path: orange_light_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/white_dark_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 7abcfb63c142dc9b88ba553746cdc404.dir
size: 5512126747
nfiles: 4000
hash: md5
path: white_dark_6ms
6 changes: 6 additions & 0 deletions datasets/TableMulticolorRecord_19_04/white_light_6ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 12fa64fd477079cbde046101bee39dcb.dir
size: 5985412843
nfiles: 4000
hash: md5
path: white_light_6ms
3 changes: 3 additions & 0 deletions datasets/TableOrange2msRecord_22_04/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/orange_dark_2ms
/orange_light_2ms
/calibration_boards
25 changes: 25 additions & 0 deletions datasets/TableOrange2msRecord_22_04/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dataset info

## Frame statistics

| | no ball | ball | too many balls |
|:---------------------|----------:|-------:|-----------------:|
| orange_light_2ms_1_1 | 554 | 446 | 0 |
| orange_light_2ms_1_2 | 550 | 450 | 0 |
| orange_light_2ms_2_1 | 493 | 339 | 168 |
| orange_light_2ms_2_2 | 200 | 578 | 222 |
| orange_light_2ms_3_1 | 515 | 482 | 3 |
| orange_light_2ms_3_2 | 571 | 429 | 0 |
| orange_light_2ms_4_1 | 459 | 529 | 12 |
| orange_light_2ms_4_2 | 488 | 467 | 45 |

| | no ball | ball |
|:--------------------|----------:|-------:|
| orange_dark_2ms_1_1 | 505 | 495 |
| orange_dark_2ms_1_2 | 489 | 511 |
| orange_dark_2ms_2_1 | 421 | 579 |
| orange_dark_2ms_2_2 | 333 | 667 |
| orange_dark_2ms_3_1 | 483 | 517 |
| orange_dark_2ms_3_2 | 382 | 618 |
| orange_dark_2ms_4_1 | 562 | 438 |
| orange_dark_2ms_4_2 | 523 | 477 |
6 changes: 6 additions & 0 deletions datasets/TableOrange2msRecord_22_04/calibration_boards.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: c1220b972df0c1240333c5a026c4625e.dir
size: 14854427229
nfiles: 8000
hash: md5
path: calibration_boards
15 changes: 15 additions & 0 deletions datasets/TableOrange2msRecord_22_04/camera_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
1:
image_size: [1920, 1200]
camera_matrix: [672.2824725267757, 0, 984.0472159818853, 0, 672.6886411532304, 602.96669930345, 0, 0, 1]
distortion_coefs: [-0.09715103386082896, 0.06788948036532018,
-0.0007157453506997161, 0.0003048354358359307, -0.003636308978789861]
rotation: [0, 0, 0]
translation: [0, 0, 0]
2:
image_size: [1920, 1200]
camera_matrix: [685.7143789189881, 0, 991.0247637161314, 0, 686.3020333004097, 601.2442243349392, 0, 0, 1]
distortion_coefs: [-0.09781628655937251, 0.07153618281495966,
-0.001066517414175782, 0.0004679942401339674, -0.003645360450147547]
rotation: [0.01175419895518242, 2.170836441913732, 2.19333242876324]
translation: [-0.06677747450343367, -1.174973690204363, 1.140354306665756]
6 changes: 6 additions & 0 deletions datasets/TableOrange2msRecord_22_04/orange_dark_2ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: c02049c918851de465ae6aa8b2699fe3.dir
size: 12110150634
nfiles: 10251
hash: md5
path: orange_dark_2ms
6 changes: 6 additions & 0 deletions datasets/TableOrange2msRecord_22_04/orange_light_2ms.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
outs:
- md5: 80d3d47cb9c6043bf9fcf485373acfc4.dir
size: 12751192086
nfiles: 9814
hash: md5
path: orange_light_2ms
56 changes: 56 additions & 0 deletions packages/camera/scripts/binary_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import argparse
import os
from concurrent.futures import ThreadPoolExecutor

import cv2
import numpy as np
from tqdm import tqdm


def save_image(i, img_data, output_folder, width, height):
img = np.frombuffer(img_data, dtype=np.uint8).reshape((height, width))
cv2.imwrite(os.path.join(output_folder, f"image_{str(i).rjust(4, '0')}.png"), img)


def read_and_convert(file_path, output_folder, width=1920, height=1200):
if not os.path.exists(output_folder):
os.makedirs(output_folder)

num_images = os.path.getsize(file_path) // width // height
print(
f"{num_images} images of size {height}x{width} will be written to",
output_folder,
)

executor = ThreadPoolExecutor()
with open(file_path, "rb") as f:
for i in tqdm(range(num_images)):
img_data = f.read(width * height)
executor.submit(save_image, i, img_data, output_folder, width, height)
# save_image(i, img_data, output_folder, width, height)


def init_parser():
parser = argparse.ArgumentParser()

parser.add_argument(
"--width", help="Width of a single frame", type=int, default=1920
)
parser.add_argument(
"--height", help="height of a single frame", type=int, default=1200
)
parser.add_argument("--source", help="Binary file.out", required=True)
parser.add_argument(
"--export",
help="Directotory to store raw single-channel .png files",
required=True,
)

return parser


if __name__ == "__main__":
parser = init_parser()
args = parser.parse_args()

read_and_convert(args.source, args.export, args.width, args.height)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy==1.24.4
opencv-python==4.8.0.76
PyYAML==5.3.1
tqdm

0 comments on commit 784c41e

Please sign in to comment.