Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwutk committed Sep 10, 2023
1 parent 5367b4e commit 393d0a2
Show file tree
Hide file tree
Showing 18 changed files with 341 additions and 1,939 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ jobs:
shell: micromamba-shell {0}
run: poetry install --no-interaction --without dev --with test

- name: Install lap (Hack)
shell: micromamba-shell {0}
run: |
pip install --upgrade pip
pip install lap
- name: Check Installed Packages
shell: micromamba-shell {0}
run: pip list
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ jobs:
shell: micromamba-shell {0}
run: poetry install --no-interaction --without dev --with test

- name: Install lap (Hack)
shell: micromamba-shell {0}
run: |
pip install --upgrade pip
pip install lap
- name: Check Installed Packages
shell: micromamba-shell {0}
run: pip list
Expand Down Expand Up @@ -128,12 +122,6 @@ jobs:
shell: micromamba-shell {0}
run: poetry install --no-interaction --without dev --with test

- name: Install lap (Hack)
shell: micromamba-shell {0}
run: |
pip install --upgrade pip
pip install lap
- name: Check Installed Packages
shell: micromamba-shell {0}
run: pip list
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ mamba activate spatialyze

# install python dependencies
poetry install
pip install lap # a bug in lap/poetry/conda that lap needs to be installed using pip.
```

## Spatialyze Demo
Expand Down
113 changes: 1 addition & 112 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,29 @@ authors = ["Your Name <you@example.com>"]
python = "^3.10"
pyquaternion = "^0.9.9"
numpy = "^1.22.4"
matplotlib = "^3.5.2"
opencv-python = "^4.6.0"
pandas = "^1.4.2"
bitarray = "^2.6.0"
tqdm = "^4.64.1"
shapely = "^1.8.5.post1"
plpygis = "^0.2.0"

# MobilityDB
psycopg2-binary = "^2.9.3"
postgis = "^1.0.4"
# python-mobilitydb = "^0.1.2"
python-mobilitydb = "^0.1.3"

[tool.poetry.group.cv.dependencies]
torch = "^1.13.0"
torchvision = "^0.14.0"
matplotlib = "^3.5.2"
scipy = "^1.4.1"
easydict = "^1.10"
gdown = "^4.7.1"
cython-bbox = {git = "https://github.com/apperception-db/cython_bbox.git"}
ultralytics = "^8.0.148"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.0"
coverage = "^7.2.7"
pytest-cov = "^4.1.0"
notebook = "^6.4.12"

[tool.poetry.group.dev.dependencies]
types-psycopg2 = "^2.9.16"
Expand Down
3 changes: 2 additions & 1 deletion scripts/import_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ def _insert_into_general_bbox(database: "Database", value: tuple, commit=True):
database._commit(commit)


import_tables(database, './data/scenic/database')
if __name__ == "__main__":
import_tables(database, './data/scenic/database')
4 changes: 2 additions & 2 deletions spatialyze/utils/F/contained.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@call_node
def contained(visitor: "GenSqlVisitor", args: "list[PredicateNode]"):
object, region = args[:2]
object, region = args
if isinstance(object, ObjectTableNode):
object = object.traj @ camera.time
return f"contained({visitor(object)}, {visitor(region)})"
return f"contained({visitor(object)},{visitor(region)})"
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import logging
import time
from typing import Callable, List, Tuple
from typing import Callable, List

import postgis
import shapely
import shapely.geometry
import torch
from bitarray import bitarray
from psycopg2 import sql
Expand Down Expand Up @@ -61,7 +59,6 @@ def _run(self, payload: "Payload"):
return keep, {DetectionEstimation.classname(): [[]] * len(keep)}

ego_views = get_ego_views(payload)
ego_views = [shapely.wkb.loads(view.to_ewkb(), hex=True) for view in ego_views]

skipped_frame_num = []
next_frame_num = 0
Expand Down Expand Up @@ -219,10 +216,10 @@ def prune_detection(
def generate_sample_plan_once(
video: "Video",
next_frame_num: "int",
ego_views: "list[shapely.geometry.Polygon]",
ego_views: "list[postgis.Polygon]",
all_detection_info: "list[DetectionInfo] | None" = None,
fps: "int" = 13,
) -> "Tuple[SamplePlan, None]":
) -> "tuple[SamplePlan, None]":
assert all_detection_info is not None
next_sample_plan = generate_sample_plan(
video, next_frame_num, all_detection_info, ego_views, 50, fps=fps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@
"""

import datetime
import os
import sys
import time
from dataclasses import dataclass, field
from typing import Any, Tuple

sys.path.append(os.path.abspath(os.path.join(os.getcwd(), os.pardir, os.pardir)))

import postgis
import shapely
import shapely.geometry

from ...camera_config import CameraConfig
from ...types import DetectionId, obj_detection
from ...video import Video
from .optimized_segment_mapping import RoadPolygonInfo, get_detection_polygon_mapping
from .sample_plan_algorithms import CAR_EXIT_SEGMENT, Action
from .segment_mapping import RoadPolygonInfo, get_detection_polygon_mapping
from .utils import (
Float2,
Float3,
Expand Down Expand Up @@ -158,7 +155,7 @@ class SamplePlan:
video: "Video"
next_frame_num: int
all_detection_info: "list[DetectionInfo]"
ego_views: "list[shapely.geometry.Polygon]"
ego_views: "list[postgis.Polygon]"
fps: int = 12
metadata: Any = None
current_priority: "float | None" = None
Expand Down Expand Up @@ -304,7 +301,7 @@ def generate_sample_plan(
video: "Video",
next_frame_num: int,
all_detection_info: "list[DetectionInfo]",
ego_views: "list[shapely.geometry.Polygon]",
ego_views: "list[postgis.Polygon]",
view_distance: float,
fps: int = 12,
):
Expand Down
Loading

0 comments on commit 393d0a2

Please sign in to comment.