Skip to content

Commit

Permalink
Merge branch 'main' into duckdb
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwutk committed Apr 24, 2024
2 parents 9aae580 + 269b76c commit 427103b
Show file tree
Hide file tree
Showing 16 changed files with 1,794 additions and 1,744 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

1 change: 0 additions & 1 deletion .env.leave

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ jobs:
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

# - name: Download Coverage
Expand Down
7 changes: 0 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ RUN apt-get update --yes --quiet
RUN apt-get install --yes --quiet --no-install-recommends \
curl ffmpeg git

RUN sed -i 's/#force_color_prompt/force_color_prompt/g' $HOME/.bashrc
RUN git clone --recurse-submodules --depth 1 https://github.com/chanwutk/.config.git $HOME/.config
RUN echo "source $HOME/.config/rc" >> $HOME/.bashrc
RUN cat <(echo "source $HOME/.config/profile") $HOME/.profile > $HOME/.profile.tmp
RUN mv $HOME/.profile.tmp $HOME/.profile


# configre python to output directly to terminal
# see: https://stackoverflow.com/questions/59812009/what-is-the-use-of-pythonunbuffered-in-docker-file
ENV PYTHONUNBUFFERED=1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
</p>
## Absract
## Abstract
Videos that are shot using commodity hardware such as phones and surveillance cameras record various metadata such as time and location.
We encounter such geospatial videos on a daily basis and such videos have been growing in volume significantly.
Yet, we do not have data management systems that allow users to interact with such data effectively.
Expand Down Expand Up @@ -122,7 +122,7 @@ jupyter-lab
The demo notebook first constructs the world. Then it queries for the trajectory of the cars that appeared once in an area of interests within some time interval.

## Citing Spatialyze
This paper is currently under review for [VLDB](https://vldb.org/2024/).
This paper will be presented at [VLDB](https://vldb.org/2024/).
```bib
@misc{kittivorawong2023spatialyze,
title={Spatialyze: A Geospatial Video Analytics System with Spatial-Aware Optimizations},
Expand Down
8 changes: 0 additions & 8 deletions environment.yml

This file was deleted.

3,477 changes: 1,765 additions & 1,712 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ torch = "^1.13.0"
torchvision = "^0.14.0"
matplotlib = "^3.5.2"
scipy = "^1.4.1"
gdown = "^4.7.3"
gdown = "^5.1.0"
ultralytics = "^8.0.148"
notebook = "^7.0.6"

Expand Down
5 changes: 3 additions & 2 deletions spatialyze/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from .video_processor.types import Float33

if TYPE_CHECKING:
from psycopg2 import connection as Connection
from psycopg2 import cursor as Cursor
from psycopg2._psycopg import connection as Connection
from psycopg2._psycopg import cursor as Cursor

from .predicate import PredicateNode

Expand Down Expand Up @@ -313,6 +313,7 @@ def predicate(self, predicate: "PredicateNode", temporal: bool = True):
def sql(self, query: str) -> pd.DataFrame:
results, cursor = self.execute_and_cursor(query)
description = cursor.description
assert description is not None
cursor.close()
return pd.DataFrame(results, columns=[d.name for d in description])

Expand Down
4 changes: 2 additions & 2 deletions spatialyze/predicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def __or__(self, other):
],
)

def __eq__(self, other):
def __eq__(self, other): # pyright: ignore [reportIncompatibleMethodOverride]
other = wrap_literal(other)
return CompOpNode(self, "eq", other)

def __ne__(self, other):
def __ne__(self, other): # pyright: ignore [reportIncompatibleMethodOverride]
other = wrap_literal(other)
return CompOpNode(self, "ne", other)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ def _r(acc: "tuple[int, list[tuple[int, int]]]", frames: int):
return None, {self.classname(): metadata}
except BaseException:
_, output = DecodeFrame()._run(payload)
return None, {self.classname(): DecodeFrame.get(output)}
images = DecodeFrame.get(output)
assert images is not None
return None, {self.classname(): images}
4 changes: 3 additions & 1 deletion spatialyze/video_processor/stages/depth_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def eval_all(self, input_images: "list[npt.NDArray | None]"):
# Load image and preprocess
input_image = pil.fromarray(im[:, :, [2, 1, 0]])
original_width, original_height = input_image.size
input_image = input_image.resize((self.feed_width, self.feed_height), pil.LANCZOS)
input_image = input_image.resize(
(self.feed_width, self.feed_height), pil.Resampling.LANCZOS
)
input_image = transforms.ToTensor()(input_image).unsqueeze(0)

# PREDICTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(self, df_annotations: "pd.DataFrame"):
self.class_to_id = {c: i for i, c in enumerate(self.id_to_classes)}

def _run(self, payload: "Payload"):
metadata: "list[Metadatum | None]" = []
metadata: list[Metadatum] = []
dimension = payload.video.dimension
for i, cc in enumerate(payload.video._camera_configs):
fid = cc.frame_id
Expand Down Expand Up @@ -224,7 +224,9 @@ def _run(self, payload: "Payload"):
else:
metadata.append(
Metadatum(
torch.Tensor(tensor), yolo_classes, [DetectionId(i, _id) for _id in ids]
torch.Tensor(tensor),
yolo_classes,
[DetectionId(i, _id) for _id in ids],
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, df_annotations: "pd.DataFrame"):
self.class_to_id = {c: i for i, c in enumerate(self.id_to_classes)}

def _run(self, payload: "Payload"):
metadata: "list[Metadatum | None]" = []
metadata: list[Metadatum] = []
dimension = payload.video.dimension
for i, cc in enumerate(payload.video._camera_configs):
fid = cc.frame_id
Expand Down Expand Up @@ -81,7 +81,9 @@ def _run(self, payload: "Payload"):
else:
metadata.append(
Metadatum(
torch.Tensor(tensor), yolo_classes, [DetectionId(i, _id) for _id in ids]
torch.Tensor(tensor),
yolo_classes,
[DetectionId(i, _id) for _id in ids],
)
)

Expand Down
4 changes: 3 additions & 1 deletion spatialyze/video_processor/stages/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@ def tqdm(cls, iterable: "Iterable[_T2]", *args, **kwargs) -> "Iterable[_T2]":
def _get_classnames(cls: "type") -> "list[str]":
if cls == Stage:
return []
return [*_get_classnames(cls.__base__), cls.__name__]
base = cls.__base__
assert base is not None
return [*_get_classnames(base), cls.__name__]
4 changes: 3 additions & 1 deletion spatialyze/video_processor/stream/mono_depth_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def _stream(self, video: Video):
# Load image and preprocess
input_image = Image.fromarray(img[:, :, [2, 1, 0]])
original_width, original_height = input_image.size
input_image = input_image.resize((md.feed_width, md.feed_height), Image.LANCZOS)
input_image = input_image.resize(
(md.feed_width, md.feed_height), Image.Resampling.LANCZOS
)
input_image = transforms.ToTensor()(input_image).unsqueeze(0)

# PREDICTION
Expand Down

0 comments on commit 427103b

Please sign in to comment.