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

feat(deepen_to_t4): add paint label downloader #107

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
ee0b18f
[update] download paint dataset
nanoshimarobot Mar 5, 2024
46d82d5
[update] 1フレーム分だけ書き込みできた
nanoshimarobot Mar 18, 2024
a3e9fa6
[fix] annotation bug
nanoshimarobot Mar 21, 2024
f5aaf3c
[fix] decompressed labelの位置オフセット計算ミス
nanoshimarobot Mar 26, 2024
74742e9
[update] paint annotation downloader
nanoshimarobot May 16, 2024
c298485
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot May 16, 2024
3ad8679
[remove] prev paint annotation downloader
nanoshimarobot May 23, 2024
ecc3477
[remove] unused paramater file
nanoshimarobot May 24, 2024
a785f28
[update] config file for paint annotaion downloader
nanoshimarobot May 24, 2024
5bf2283
[update] modified config for paint downloader
nanoshimarobot May 24, 2024
5ba44bf
[refactor] download_paint_annotations
nanoshimarobot May 24, 2024
abfc575
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot May 24, 2024
154b6cd
[fix] gitignore, configs
nanoshimarobot May 24, 2024
395533d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 24, 2024
dea76e4
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Jun 6, 2024
9c1d990
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Jun 11, 2024
57a4d33
[update] add return type hint
nanoshimarobot Jun 16, 2024
54f0bce
[update] add checks for the existence of environment variables
nanoshimarobot Jun 16, 2024
a7538d4
[remove] unnecessary debug output
nanoshimarobot Jun 16, 2024
69ce89a
[update] exit if response contains HTTP status error
nanoshimarobot Jun 16, 2024
f803a38
[update] add main()
nanoshimarobot Jun 16, 2024
58c4e78
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 16, 2024
f674d9c
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Jun 16, 2024
a4eb462
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Jun 21, 2024
701d23a
[remove] unused module
nanoshimarobot Jun 24, 2024
f0f3e9a
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Jun 25, 2024
5259c43
fix(non_annotated_t4_to_deepen): skip frame when some cameras do not …
kminoda Jun 25, 2024
6c4aa99
docs: update dataset description (#121)
miursh Jul 3, 2024
511eb3c
fix: rosbag conversion (#123)
miursh Jul 4, 2024
9f80aef
feat: add `tier4-devkit` library (#111)
ktro2828 Jul 11, 2024
8fd99ce
build(deps): bump zipp from 3.18.2 to 3.19.1 (#128)
dependabot[bot] Jul 12, 2024
1bd6842
fix missing transforms3d dependency (#125)
ralwing Jul 13, 2024
129c6f5
chore: release v1.0.12 (#130)
miursh Jul 13, 2024
b2a1e54
chore: add config yaml (#131)
miursh Jul 13, 2024
148fa0b
fix(t4-devkit): resolve unexpected point normalization (#133)
ktro2828 Jul 23, 2024
919c098
docs: comlops dataset design (#134)
miursh Jul 24, 2024
ad29f0f
feat(t4-devkit): remove `SensorChannel` and replace it by `str` (#132)
ktro2828 Jul 26, 2024
2e4a298
release v1.0.13 (#135)
miursh Jul 29, 2024
5822641
fix(rosbag2_to_non_annotated_t4): decoding pointcloud2 msg (#137)
miursh Aug 1, 2024
1e1d5db
feat(rosbag2_to_non_annotated_t4): support uint8 intensity (#138)
miursh Aug 2, 2024
499ac09
chore: fix push release tag workflow (#143)
miursh Aug 8, 2024
5c82138
feat: update pydantic version (#139)
tughril Aug 11, 2024
712410a
[pre-commit.ci] pre-commit autoupdate (#144)
pre-commit-ci[bot] Aug 13, 2024
3e4d23d
fix(utils): add cast for intensity (#129)
kminoda Aug 13, 2024
56bf74e
chore: updated installation instructions (follows the ci/cd ones that…
knzo25 Aug 13, 2024
7e7a126
fix(convert_rosbag2_with_gt_to_annotated_t4_tlr): add skip method whe…
MasatoSaeki Aug 15, 2024
67ef6dc
feat(non_annotated_t4_tlr_to_deepen): add conversion tool (#142)
kminoda Aug 26, 2024
b5064fc
feat(t4 devkit): add support of saving rendering result as `.rrd` (#146)
ktro2828 Aug 29, 2024
b64d712
chode: fix typo of `occlusion` (#151)
ktro2828 Sep 6, 2024
32f4c85
fix(non_annotated_t4_to_deepen): fix frame skipping logic (#153)
miursh Sep 19, 2024
3065e32
fix(t4-devkit): resolve rendering issues (#155)
ktro2828 Sep 26, 2024
304d23c
feat: support march 2024 RX2 conversion (#120)
miursh Oct 14, 2024
1016c4d
chore: delete `t4-devkit` (#160)
ktro2828 Oct 18, 2024
f44b7ab
feat: import deepen label functionality (#159)
miursh Oct 30, 2024
54154e1
chore: bump to v1.0.16 (#162)
ktro2828 Oct 30, 2024
6d3eed4
feat: add upload_dataset functionality (#158)
miursh Nov 2, 2024
eb8cf77
docs: add automatic_annotation information (#166)
miursh Nov 12, 2024
832960b
feat(rosbag2_to_non_annotated_t4): support image undistortion option …
miursh Nov 12, 2024
444947c
docs: update the description of ego_pose coordinate system (#167)
miursh Nov 12, 2024
fc9ba66
fix(rosbag2_to_non_annotated_t4): enhance point_cloud2_to_array to su…
miursh Nov 13, 2024
a33d125
feat(deepen): add support of converting deepen 2D segmentation annota…
ktro2828 Nov 21, 2024
c099086
feat: update record classes for CoMLOPs format (#163)
ktro2828 Nov 21, 2024
07d1ab0
increment version number (#170)
miursh Nov 22, 2024
29553ae
Merge branch 'main' into feat/ground_seg_annotation
nanoshimarobot Nov 30, 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
19 changes: 19 additions & 0 deletions config/convert_deepen_to_t4_paint_sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
task: convert_deepen_to_t4
description:
visibility:
full: "No occlusion of the object."
most: "Object is occluded, but by less than 50%."
partial: "The object is occluded by more than 50% (but not completely)."
none: "The object is 90-100% occluded and no points/pixels are visible in the label."
camera_index:
CAM_FRONT: 0
CAM_FRONT_RIGHT: 1
CAM_BACK_RIGHT: 2
CAM_BACK: 3
CAM_BACK_LEFT: 4
CAM_FRONT_LEFT: 5

conversion:
input_base: ./data/non_annotated_t4_format
dataset_corresponding:
Dataset_name: dataset_id_in_Deepen_AI
106 changes: 106 additions & 0 deletions perception_dataset/deepen/download_paint_annotations_to_pcd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import argparse
from datetime import date
import json
import os
import zlib

import numpy as np
import requests
import tqdm
import yaml

if os.environ.get("DEEPEN_CLIENT_ID") is None or os.environ.get("DEEPEN_ACCESS_TOKEN") is None:
raise ValueError(
'You need to properly set the environment variables "DEEPEN_CLIENT_ID" and "DEEPEN_ACCESS_TOKEN"'
)
else:
CLIENT_ID = os.environ["DEEPEN_CLIENT_ID"]
ACCESS_TOKEN = os.environ["DEEPEN_ACCESS_TOKEN"]

today = str(date.today()).replace("-", "")
NUM_DIMENSIONS = 5


def get_datasets(dataset_id: str, input_base_dir: str) -> None:
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
}

if dataset_id is None:
print("Dataset ID not found")
return

DATASET_URL = f"https://tools.deepen.ai/api/v2/datasets/{dataset_id}/label_types/3d_point/paint_labels?stageId=QA"

try:
response = requests.get(DATASET_URL, headers=headers)
response.raise_for_status()
except requests.exceptions.RequestException as e:
raise SystemExit(e)

decompress_data = bytearray(zlib.decompress(bytearray(response.content)))

header_list = list(response.headers.values())
label_info = json.loads(header_list[3])
frame_size = list(label_info["frame_sizes"])

# [
# [l,l,l,l,...],
# [l,l,l,l,...],
# ...
# ]

label_list = []
offset = 0
for i in range(len(frame_size)):
offset += frame_size[i - 1] if i != 0 else 0
label_list.append(
np.array([decompress_data[offset + j] for j in range(frame_size[i])], dtype=np.uint32)
)

sample_data_file = os.path.join(input_base_dir, "annotation", "sample_data.json")
sample_data = json.load(open(sample_data_file, "r"))
sample_data = list(filter(lambda d: d["filename"].split(".")[-2] == "pcd", sample_data))

for i in tqdm.tqdm(range(0, len(sample_data))):
pcd_file_path = os.path.join(input_base_dir, sample_data[i]["filename"])
scan = np.fromfile(pcd_file_path, dtype=np.float32)
points: np.ndarray = scan.reshape((-1, NUM_DIMENSIONS)) # 行数,列数
labelled_points: np.ndarray = np.concatenate(
[points, label_list[i].reshape(-1, 1)], 1, dtype=np.float32
)
labelled_points.tofile(pcd_file_path)


def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--config",
type=str,
default="config/convert_deepen_to_t4.yaml",
)
parser.add_argument(
"--output_dir",
type=str,
default=".",
help="the directory where the annotation file is saved.",
)
args = parser.parse_args()

with open(args.config) as f:
config = yaml.safe_load(f)

assert (
config["task"] == "convert_deepen_to_t4"
), f"use config file of convert_deepen_to_t4 task: {config['task']}"
dataset_id = list(config["conversion"]["dataset_corresponding"].values())
input_base_dir = os.path.join(
config["conversion"]["input_base"], os.listdir(config["conversion"]["input_base"])[0]
)

get_datasets(dataset_id[0], input_base_dir)
ktro2828 marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == "__main__":
main()