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

Cleanup Dependencies #21

Merged
merged 9 commits into from
Sep 10, 2023
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
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.

8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,30 @@ 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"
notebook = "^6.5.5"

[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
2 changes: 1 addition & 1 deletion scripts/commit-and-push-if-latest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ! git diff --exit-code site src test test-runtime; then
if ! git diff --exit-code data evaluation spatialyze; then
git add --all
git config --global user.name 'Github Actions Bot'
git config --global user.email 'spatialyze-actions-bot@users.noreply.github.com'
Expand Down
2 changes: 1 addition & 1 deletion scripts/commit-and-push.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ! git diff --exit-code site src test test-runtime; then
if ! git diff --exit-code data evaluation spatialyze; then
git add --all
git config --global user.name 'Github Actions Bot'
git config --global user.email 'spatialyze-actions-bot@users.noreply.github.com'
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')
16 changes: 14 additions & 2 deletions spatialyze/utils/F/contained.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from .custom_fn import custom_fn
from ...predicate import (
GenSqlVisitor,
ObjectTableNode,
PredicateNode,
call_node,
camera,
)

contained = custom_fn("contained", 2)

@call_node
def contained(visitor: "GenSqlVisitor", args: "list[PredicateNode]"):
object, region = args
if isinstance(object, ObjectTableNode):
object = object.traj @ camera.time
return f"contained({visitor(object)},{visitor(region)})"
15 changes: 5 additions & 10 deletions spatialyze/video_processor/stages/detection_estimation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
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

from spatialyze.database import database

from ....database import database
from ...camera_config import CameraConfig
from ...payload import Payload
from ...types import DetectionId
from ...types import DetectionId, obj_detection
from ...video import Video
from ..detection_2d.detection_2d import Detection2D
from ..detection_2d.detection_2d import Metadatum as D2DMetadatum
Expand All @@ -25,7 +22,6 @@
SamplePlan,
construct_all_detection_info,
generate_sample_plan,
obj_detection,
)
from .utils import get_ego_avg_speed, trajectory_3d

Expand Down Expand Up @@ -61,7 +57,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 +214,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,26 +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 ...types import DetectionId, Float2, Float3, Float22, 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,
Float22,
get_car_exits_view_frame_num,
get_segment_line,
time_to_exit_current_segment,
Expand All @@ -52,7 +45,7 @@ class DetectionInfo:
road_polygon_info: "RoadPolygonInfo"
car_loc3d: "Float3"
car_loc2d: "Float2"
car_bbox3d: "Tuple[Float3, Float3]"
car_bbox3d: "tuple[Float3, Float3]"
car_bbox2d: "Float22"
ego_trajectory: "list[trajectory_3d]"
ego_config: "CameraConfig"
Expand Down Expand Up @@ -158,9 +151,8 @@ 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
action: "Action | None" = None

Expand Down Expand Up @@ -304,7 +296,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