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): Add converter from non-annotated T4 to empty-annotated T4 #165

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os.path as osp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not related to this part)
Would you also add a document for using this?

import shutil
import time

from perception_dataset.abstract_converter import AbstractConverter
from perception_dataset.utils.logger import configure_logger

logger = configure_logger(modname=__name__)


class NonAnnotatedT4ToEmptyAnnotationT4Converter(AbstractConverter):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class NonAnnotatedT4ToEmptyAnnotationT4Converter(AbstractConverter):
class NonAnnotatedT4ToEmptyAnnotatedT4Converter(AbstractConverter):

"""
Convert non-annotated T4 dataset to empty annotated T4 dataset, where we assume an output_base contains the following contents:
status.json
annotations/
data/

And this converter will move rosbags from an input_base to the output_base.
"""

def __init__(
self,
input_base: str,
output_base: str,
):
super().__init__(input_base, output_base)

def convert(self):
start_time = time.time()

# Move rosbag files to input_rosbags
self._move_rosbags()
elapsed_time = time.time() - start_time
logger.info(f"Elapsed time: {elapsed_time:.1f} [sec]")

def _move_rosbags(self) -> None:
"""Move rosbags from an input_base to ."""
output_bag_dir: str = osp.join(self._output_base, "input_bag")
self._copy_data(output_bag_dir)

def _copy_data(self, output_dir: str) -> None:
"""Copy data from the input_dir to the output_dir."""
if self._input_base != output_dir:
logger.info(f"Copying {self._input_base} to {output_dir} ... ")
shutil.copytree(self._input_base, output_dir)
logger.info("Done!")
Loading