Skip to content

Commit e73fd33

Browse files
Merge pull request #6 from UTAustin-SwarmLab/0.0.2
0.0.2
2 parents 4982d09 + cd83919 commit e73fd33

14 files changed

Lines changed: 630 additions & 163 deletions

File tree

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu20.04
88
CODE_PATH := /home/mc76728/repos/Video-to-Automaton/
99

1010
# Custom Image
11-
MY_DOCKER_IMG := ${user}video_to_automaton_test
11+
MY_DOCKER_IMG := ${user}ns_vfs
1212
TAG := latest
1313

1414
pull_docker_image:
@@ -24,7 +24,7 @@ run_docker_container:
2424
--name ${MY_DOCKER_IMG} \
2525
--cap-add=SYS_PTRACE \
2626
--ulimit core=0:0 \
27-
--volume ${CODE_PATH}:/opt/Video-to-Automoton \
27+
--volume ${CODE_PATH}:/opt/Neuro-Symbolic-Video-Frame-Search \
2828
${MY_DOCKER_IMG}:${TAG} \
2929
/bin/bash
3030

@@ -37,11 +37,11 @@ run_docker_container_gpu:
3737
--runtime=nvidia \
3838
--cap-add=SYS_PTRACE \
3939
--ulimit core=0:0 \
40-
--volume ${CODE_PATH}:/opt/Video-to-Automoton \
40+
--volume ${CODE_PATH}:/opt/Neuro-Symbolic-Video-Frame-Search \
4141
${MY_DOCKER_IMG}:${TAG} \
42-
/bin/bash
42+
/bin/bashd
4343

44-
exec:
44+
exec_docker_container:
4545
docker exec -it ${MY_DOCKER_IMG} /bin/bash
4646

4747
stop_docker_container:

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
# Video to Automaton
1+
# Neuro Symbolic Video Frame Search
2+
3+
## Installation Guid
4+
**Prerequisites** <br>
5+
No need to worry about the prerequisites below if you are using a UT Swarm Lab cluster.
6+
7+
* CUDA Driver: Version 11.8.0 or higher
8+
* Docker: Nvidia Driver
9+
D
10+
**evelopment Environment Setup**
11+
12+
1. Clone this repository.
13+
2. Navigate to the makefile and modify the user input section.
14+
15+
For example: `CODE_PATH := /home/repos/Neuro-Symbolic-Video-Frame-Search/`
16+
17+
3. Execute `make pull_docker_image`
18+
4. Execute `make build_docker_image`
19+
5. Execute `make run_docker_container_gpu`
20+
6. Execute `make exec_docker_container`
21+
7. Inside the container, navigate to `/opt/Neuro-Symbolic-Video-Frame-Search`
22+
8. Inside the container, execute `bash install.sh`
23+
24+
**Development Inside the Container** <br>
25+
Enjoy your development environment inside the container!
26+
27+
Please avoid stopping and removing the container, as you will need to reinstall the dependencies. If the container is stopped or removed, repeat steps 5 to 8.
28+
29+
## Dataset
30+
[The VIRAT Video Dataset](https://viratdata.org/#getting-data): The VIRAT Video Dataset is designed to be realistic, natural and challenging for video surveillance domains in terms of its resolution, background clutter, diversity in scenes, and human activity/event categories than existing action recognition datasets. It has become a benchmark dataset for the computer vision community.
31+
32+
[NuScenes](https://www.nuscenes.org/nuimages#download): A public large-scale dataset for autonomous driving

docker/Dockerfile

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,52 @@ RUN apt-get update && apt-get install -y \
1010
ffmpeg git vim libglew-dev libglfw3-dev libglm-dev \
1111
tmux wget unzip unrar curl \
1212
x11-xserver-utils xvfb \
13-
gcc g++ make cmake
13+
make cmake
1414

15+
# RUN apt-get apt-get install -y \
16+
# gcc g++
1517
#----------------------------------------------#
1618
# Install project dependent system dependencies
1719

1820
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
21+
1922
RUN apt-get install -y \
2023
python3-pip python3.8-venv \
21-
rustc cargo \
22-
&& apt-get clean
24+
build-essential libboost-all-dev libcln-dev \
25+
libgmp-dev libginac-dev automake libglpk-dev \
26+
libhwloc-dev libz3-dev libxerces-c-dev libeigen3-dev \
27+
software-properties-common
2328

24-
# # Python
29+
# FOR GROUNDING DINO
30+
RUN apt-get install -y \
31+
rustc cargo
32+
33+
#---------------------DO NOT CHANGE BELOW---------------------#
34+
# STORMPY PACKAGE INSTALLATION
35+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
36+
RUN apt install -y g++-11 \
37+
&& apt-get clean
38+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 \
39+
--slave /usr/bin/g++ g++ /usr/bin/g++-11
40+
# GIT CLONE
41+
WORKDIR /opt
42+
RUN git clone -b stable https://github.com/moves-rwth/carl-storm
43+
RUN git clone -b stable https://github.com/moves-rwth/storm.git
44+
RUN git clone -b stable https://github.com/moves-rwth/stormpy.git
45+
# INSTALL CARL STORM
46+
WORKDIR /opt/carl-storm
47+
RUN mkdir build && cd build && cmake ../ && make lib_carl -j 2
48+
# INSTALL STORM
49+
WORKDIR /opt/storm
50+
ENV STORM_HOME=/opt/storm
51+
RUN mkdir build && cd build && cmake ../ && make
52+
RUN export PATH=$PATH:$STORM_DIR/build/bin
53+
# INSTALL STORMPY
54+
WORKDIR /opt/stormpy
55+
RUN python3 -m pip install -ve .
56+
#---------------------DO NOT CHANGE ABOVE---------------------#
57+
# PYTHON TORCH
2558
RUN python3 -m pip install --upgrade pip build
2659
RUN pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118
27-
2860
#----------------------------------------------#
29-
WORKDIR /opt/Video-to-Automoton
61+
WORKDIR /opt/Neuro-Symbolic-Video-Frame-Search

install.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ elif [[ ! -d $WEIGHT_DIR ]]; then
1515
echo "$WEIGHT_DIR already exists but is not a directory" 1>&2
1616
fi
1717

18-
# # -- Installing GroundingDINO -- #
19-
# echo "Installing GroundingDINO"
20-
# git submodule init
21-
# git submodule update
22-
23-
# cd $ROOT_DIR/video_to_automaton/GroundingDINO
24-
# git checkout -q 57535c5a79791cb76e36fdb64975271354f10251
25-
2618
# -- Installing video_to_automaton -- #
2719
echo "Installing video_to_automaton"
2820
cd $ROOT_DIR

main.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
from ns_vfs.config.loader import load_config
44
from ns_vfs.model.vision.grounding_dino import GroundingDino
55
from ns_vfs.processor.video_processor import (
6-
VideoFrameProcessor,
6+
VideoFrameWindowProcessor,
77
)
88
from ns_vfs.video_to_automaton import VideotoAutomaton
99

1010
if __name__ == "__main__":
11-
sample_video_path = "/opt/Video-to-Automoton/artifacts/data/hmdb51/clap/Applauding_Abby_clap_u_nm_np1_fr_med_1.avi"
11+
sample_video_path = "/opt/Neuro-Symbolic-Video-Frame-Search/artifacts/data/summer_event/bali_beach_club_pt1_720p.mp4"
1212

1313
config = load_config()
1414

@@ -20,10 +20,14 @@
2020
weight_path=config.GROUNDING_DINO.GROUNDING_DINO_CHECKPOINT_PATH,
2121
config_path=config.GROUNDING_DINO.GROUNDING_DINO_CONFIG_PATH,
2222
),
23-
video_processor=VideoFrameProcessor(video_path=sample_video_path),
24-
proposition_set=["clap", "face", "baby"],
25-
)
26-
states, transitions, prev_states = frame2automaton.build_automaton(
27-
is_annotation=False
23+
video_processor=VideoFrameWindowProcessor(
24+
video_path=sample_video_path,
25+
artifact_dir=config.VERSION_AND_PATH.ARTIFACTS_PATH,
26+
),
27+
proposition_set=["person", "drink"],
28+
artifact_dir=config.VERSION_AND_PATH.ARTIFACTS_PATH,
2829
)
30+
31+
frame_window_automata = frame2automaton.run()
32+
2933
print("Development is in progress.")

ns_vfs/common/utility.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from datetime import datetime
2+
3+
4+
def get_filename_with_datetime(base_name):
5+
current_time = datetime.now().strftime("%Y%m%d_%H%M%S")
6+
return f"{base_name}_{current_time}.png"

ns_vfs/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
config = omegaconf.load_config_from_yaml(config_path)
1212

13-
config.VERSION_AND_PATH.ROOT_PATH = ROOT_DIR
13+
config.VERSION_AND_PATH.ROOT_PATH = os.path.join(ROOT_DIR)
1414
config.VERSION_AND_PATH.ARTIFACTS_PATH = os.path.join(ROOT_DIR, "artifacts")

ns_vfs/data/__init__.py

Whitespace-only changes.

ns_vfs/data/frame.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import dataclasses
2+
3+
import numpy as np
4+
5+
6+
@dataclasses.dataclass
7+
class Frame:
8+
"""Frame class."""
9+
10+
frame_index: int
11+
frame_image: np.ndarray
12+
propositional_probability: dict = dataclasses.field(default_factory=dict)
13+
14+
15+
@dataclasses.dataclass
16+
class FrameWindow:
17+
"""Frame window class."""
18+
19+
frame_window_idx: int
20+
frame_image_set: list = dataclasses.field(default_factory=list)
21+
states: list = dataclasses.field(default_factory=list)
22+
transitions: list = dataclasses.field(default_factory=list)
23+
verification_result: bool = False
24+
25+
def get_propositional_confidence(self):
26+
propositional_confidence = [
27+
[] for i in range(len(self.frame_image_set[0].propositional_probability.keys()))
28+
]
29+
propositional_confidence
30+
for frame in self.frame_image_set:
31+
frame: Frame
32+
idx = 0
33+
for prop in frame.propositional_probability.keys():
34+
propositional_confidence[idx].append(frame.propositional_probability[prop])
35+
idx += 1
36+
self.propositional_confidence = propositional_confidence
37+
return propositional_confidence
38+
39+
def update_states(self, states):
40+
self.states = states
41+
return states

0 commit comments

Comments
 (0)