Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions apperception/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
("itemId", "TEXT"),
("cameraId", "TEXT"),
("objectType", "TEXT"),
("color", "TEXT"),
("roadTypes", "ttext"),
("trajCentroids", "tgeompoint"),
("translations", "tgeompoint"), # [(x,y,z)@today, (x2, y2,z2)@tomorrow, (x2, y2,z2)@nextweek]
("largestBbox", "stbox"),
("itemHeadings", "tfloat"),
# ("roadPolygons", "tgeompoint"),
# ("period", "period") [today, nextweek]
]

Expand Down
2 changes: 2 additions & 0 deletions apperception/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .get_video_box import get_video_box
from .get_video_roi import get_video_roi
from .import_tables import import_tables
from .import_pickle import import_pickle
from .ingest_road import ingest_road
from .join import join
from .overlay_bboxes import overlay_bboxes
Expand All @@ -35,6 +36,7 @@
"create_transform_matrix",
"world_to_pixel",
"import_tables",
"import_pickle",
"export_tables",
"datetimes_to_framenums",
"get_video_roi",
Expand Down
35 changes: 35 additions & 0 deletions apperception/utils/import_pickle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import pickle

from apperception.database import Database
from apperception.data_types import Camera, CameraConfig


def import_pickle(database: "Database", data_path: str):
with open(os.path.join(data_path, "frames-compressed.pickle"), "rb") as f:
data_frames = pickle.loads(f.read())

database.reset(False)
for scene, val in data_frames.items():
scene_info = scene.split("-")
scene_id = scene_info[0] + "-" + scene_info[1]
configs = [
CameraConfig(
frame_id=frame[1],
frame_num=int(frame[2]),
filename=frame[3],
camera_translation=frame[4],
camera_rotation=frame[5],
camera_intrinsic=frame[6],
ego_translation=frame[7],
ego_rotation=frame[8],
timestamp=frame[9].timestamp(),
cameraHeading=frame[10],
egoHeading=frame[11],
)
for frame in val["frames"]
]
camera = Camera(config=configs, id=scene_id)
database.insert_cam(camera)

database._commit()
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def _run(self, payload: "Payload"):

assert len(detection_2d) != 0
_, class_mapping = detection_2d[0]
assert isinstance(class_mapping, list)
type_indices_to_keep: "set[int]" = set()

for t in self.types:
Expand Down
4 changes: 3 additions & 1 deletion optimized_ingestion/stages/detection_estimation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def __init__(self, predicate: "Callable[[DetectionInfo], bool]" = lambda _: True
self.predicate = predicate
super(DetectionEstimation, self).__init__()

# @cache
def filter(self, predicate: "Callable[[DetectionInfo], bool]"):
self.predicate = predicate

def _run(self, payload: "Payload"):
if Detection2D.get(payload) is None:
raise Exception()
Expand Down
Loading