Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
minkyuchoi-07 committed Dec 16, 2023
1 parent 20af652 commit 8bad017
Show file tree
Hide file tree
Showing 30 changed files with 2,693 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "your_project_name"
version = "0.0.1"
name = "tlv_data"
version = "1.0.0"
authors = [
{ name="Example Author", email="author@example.com" },
{ name="Minkyu Choi", email="minkyu.choi@utexas.edu" },
]
description = "A small example package"
description = "Temporal Logic Video (TLV) Dataset"
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand Down Expand Up @@ -40,9 +40,9 @@ select = [
"D", # pydocstyle
]

[tool.ruff.pydocstyle]
convention = "google"

ignore = ["ANN101", "ANN102"]

extend-exclude = [".venv", "venv", "vscode"]

[tool.ruff.pydocstyle]
convention = "google"
114 changes: 114 additions & 0 deletions run_scripts/run_1_synthetic_tlv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import argparse

if __name__ == "__main__":
parser = argparse.ArgumentParser()

# - - - - - - - COMMON ARGUMENTS - - - - - - - #
parser.add_argument(
"--type_of_generator",
type=str,
default="synthetic",
choices=["synthetic", "real"],
)
parser.add_argument(
"--dataloader",
type=str,
default="coco",
choices=[
"coco",
"imagenet",
"cifar10",
"cifar100",
"waymo",
"nuscenes",
],
)
parser.add_argument(
"--save_dir",
type=str,
default="",
)
# - - - - - - Synthetic Generator - - - - - - #
parser.add_argument(
"--initial_number_of_frame",
type=int,
default=25,
)
parser.add_argument(
"--max_number_frame",
type=int,
default=200,
)
parser.add_argument(
"--number_video_per_set_of_frame",
type=int,
default=3,
)
parser.add_argument(
"--increase_rate",
type=int,
default=3,
)
parser.add_argument(
"--ltl_logic",
type=str,
default="all",
choices=["all", "F prop1", "G prop1", "prop1 U prop2", "prop1 & prop2"],
)
parser.add_argument(
"--save_frames",
type=bool,
default=False,
)

# Start.
args = parser.parse_args()

if args.type_of_generator == "synthetic":
from tlv_dataset.generator.synthetic_tlv_generator import (
SyntheticTLVGenerator,
)
from tlv_dataset.loader.coco import COCOImageLoader
from tlv_dataset.loader.imagenet import ImageNetDataloader
from tlv_dataset.loader.cifar import Cifar10ImageLoader
from tlv_dataset.loader.cifar import Cifar100ImageLoader

valid_dataloader = ["coco", "imagenet", "cifar10", "cifar100"]
assert (
args.dataloader in valid_dataloader
), "please use valide dataloader for synthetic tlv dataset: coco, imagenet,cifar10, cifar100"
if args.dataloader == "coco":
dataloader = COCOImageLoader()

elif args.dataloader == "imagenet":
dataloader = ImageNetDataloader()

elif args.dataloader == "cifar10":
dataloader = Cifar10ImageLoader()

elif args.dataloader == "cifar100":
dataloader = Cifar100ImageLoader()

TLV_generator = SyntheticTLVGenerator(
dataloader=dataloader, save_dir=args.save_dir
)

if args.ltl_logic == "all":
available_tl = [
"F prop1",
"G prop1",
"prop1 U prop2",
"prop1 & prop2",
]
else:
available_tl = [args.ltl_logic]
for tl in available_tl:
TLV_generator.generate(
initial_number_of_frame=args.initial_number_of_frame,
max_number_frame=args.max_number_frame,
number_video_per_set_of_frame=args.number_video_per_set_of_frame,
increase_rate=args.increase_rate,
ltl_logic=tl,
present_prop1_till_prop2=args.present_prop1_till_prop2,
save_frames=args.save_frames,
)
114 changes: 114 additions & 0 deletions run_scripts/run_2_synthetic_tlv_until_long_horizon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import argparse

if __name__ == "__main__":
parser = argparse.ArgumentParser()

# - - - - - - - COMMON ARGUMENTS - - - - - - - #
parser.add_argument(
"--type_of_generator",
type=str,
default="synthetic",
choices=["synthetic", "real"],
)
parser.add_argument(
"--dataloader",
type=str,
default="coco",
choices=[
"coco",
"imagenet",
"cifar10",
"cifar100",
"waymo",
"nuscenes",
],
)
parser.add_argument(
"--save_dir",
type=str,
default="",
)
# - - - - - - Synthetic Generator - - - - - - #
parser.add_argument(
"--initial_number_of_frame",
type=int,
default=25,
)
parser.add_argument(
"--max_number_frame",
type=int,
default=200,
)
parser.add_argument(
"--number_video_per_set_of_frame",
type=int,
default=3,
)
parser.add_argument(
"--increase_rate",
type=int,
default=3,
)
parser.add_argument(
"--ltl_logic",
type=str,
default="all",
choices=["all", "F prop1", "G prop1", "prop1 U prop2", "prop1 & prop2"],
)
parser.add_argument(
"--save_frames",
type=bool,
default=False,
)

# Start.
args = parser.parse_args()

if args.type_of_generator == "synthetic":
from tlv_dataset.generator.synthetic_tlv_generator import (
SyntheticTLVGenerator,
)
from tlv_dataset.loader.coco import COCOImageLoader
from tlv_dataset.loader.imagenet import ImageNetDataloader
from tlv_dataset.loader.cifar import Cifar10ImageLoader
from tlv_dataset.loader.cifar import Cifar100ImageLoader

valid_dataloader = ["coco", "imagenet", "cifar10", "cifar100"]
assert (
args.dataloader in valid_dataloader
), "please use valide dataloader for synthetic tlv dataset: coco, imagenet,cifar10, cifar100"
if args.dataloader == "coco":
dataloader = COCOImageLoader()

elif args.dataloader == "imagenet":
dataloader = ImageNetDataloader()

elif args.dataloader == "cifar10":
dataloader = Cifar10ImageLoader()

elif args.dataloader == "cifar100":
dataloader = Cifar100ImageLoader()

TLV_generator = SyntheticTLVGenerator(
dataloader=dataloader, save_dir=args.save_dir
)

if args.ltl_logic == "all":
available_tl = [
"F prop1",
"G prop1",
"prop1 U prop2",
"prop1 & prop2",
]
else:
available_tl = [args.ltl_logic]
for tl in available_tl:
TLV_generator.generate(
initial_number_of_frame=args.initial_number_of_frame,
max_number_frame=args.max_number_frame,
number_video_per_set_of_frame=args.number_video_per_set_of_frame,
increase_rate=args.increase_rate,
ltl_logic=tl,
present_prop1_till_prop2=args.present_prop1_till_prop2,
save_frames=args.save_frames,
)
88 changes: 88 additions & 0 deletions run_scripts/run_3_real_tlv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import argparse

if __name__ == "__main__":
parser = argparse.ArgumentParser()

# - - - - - - - COMMON ARGUMENTS - - - - - - - #
parser.add_argument(
"--type_of_generator",
type=str,
default="synthetic",
choices=["synthetic", "real"],
)
parser.add_argument(
"--dataloader",
type=str,
default="coco",
choices=[
"coco",
"imagenet",
"cifar10",
"cifar100",
"waymo",
"nuscenes",
],
)
parser.add_argument(
"--save_dir",
type=str,
default="",
)
# - - - - - - Real Generator - - - - - - #
parser.add_argument(
"--unique_propositions",
type=list,
default=None,
)
parser.add_argument(
"--tlv_data_dir",
type=str,
default=None,
)
# - - - - - - Nuscenes Loader - - - - - - #
parser.add_argument(
"--dataroot",
type=str,
default=None,
)
parser.add_argument(
"--version",
type=str,
default="v1.0-mini",
)
parser.add_argument(
"--verbose",
type=bool,
default=False,
)

# Start.
args = parser.parse_args()

if args.type_of_generator == "real":
from tlv_dataset.generator.real_tlv_generator import RealTLVGenerator
from tlv_dataset.loader.nuscenes import NuScenesImageLoader
from tlv_dataset.loader.waymo import WaymoImageLoader

valid_dataloader = ["waymo", "nuscenes"]
assert (
args.dataloader in valid_dataloader
), "please use valide dataloader for real tlv dataset: waymo, nuscenes"

if args.dataloader == "waymo":
dataloader = WaymoImageLoader()

elif args.dataloader == "nuscenes":
dataloader = NuScenesImageLoader(
dataroot=args.dataroot,
version=args.version,
verbose=args.verbose,
)

TLV_generator = RealTLVGenerator(
dataloader=dataloader,
save_dir=args.save_dir,
unique_propositions=args.unique_propositions,
tlv_data_dir=args.tlv_data_dir,
)
TLV_generator.generate()
Binary file added tlv_dataset/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions tlv_dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Package containing your_project name."""
__version__ = "0.0.1"
Empty file added tlv_dataset/common/__init__.py
Empty file.
Loading

0 comments on commit 8bad017

Please sign in to comment.