Giter Site home page Giter Site logo

blazeit's Introduction

BlazeIt

This is the official project page for the BlazeIt project.

Please read the paper for full technical details.

Requirements

This repository contains the code for the optimization step in the paper.

You will need the following installed:

  • python 3.x
  • CUDA, CUDNN
  • torch, torchvision, pandas, opencv (with FFMpeg bindings)

Your machine will need at least:

  • 300+GB of memory
  • 500+GB of space
  • A GPU (this has only been tested with NVIDIA P100 and V100)

Installation

You will need to install the following packages:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
conda install -c conda-forge opencv
conda install -c conda-forge pyclipper

(conda can be replaced with pip).

You will also need to swag (GitHub here) and blazeit.

Reproducing experiments

IMPORTANT: your runtimes may vary depending on the GPU you are using.

  1. Download the data below. The data is expected to be in /lfs/1/ddkang/blazeit/data.

  2. Extract the videos into npy files (this is currently required). For exampe, run:

python gen_small_vid.py --base_name jackson-town-square --date 2017-12-14

in the scripts directory.

  1. To reproduce the aggregation experiments, in the aggregation folder, run
mkdir csvs
time python run_counter.py --base_name jackson-town-square \
  --train_date 2017-12-14 --thresh_date 2017-12-16 --test_date 2017-12-17 \
  --objects car --no-load_video --out_csv csvs/jackson-town-square-2017-12-17.csv

to generate predicted counts per frame.

Then run

time python run_ebs_sampling.py \
  --obj_name car --err_tol 0.01 \
  --base_name jackson-town-square --test_date 2017-12-17 --train_date 2017-12-14

to run EBS sampling.

  1. To reproduce the limit query experiments, in the scrubbing folder, run:
time python taipei-scrubbing.py --base_name jackson-town-square \
  --train_date 2017-12-14 --thresh_date 2017-12-16 --test_date 2017-12-17 \
  --objects car --no-load_video --counts 5 --labeler mock-detectron --limit 10

Datasets

We currently have released the night-street (i.e., jackson-town-square) data. The data is available here.

Please email the first author directly for other datasets.

blazeit's People

Contributors

ddkang avatar jtguibas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blazeit's Issues

Trackid from the entity resolution method

Thanks for sharing code and dataset.
According to your paper, trackid is generated from the entity resolution method, but I couldn't fully understand how it works.
Could you let me know the detailed algorithm for getting trackid or where can i find the code for generating trackid?

Issue with Missing 'detectron.tools.standalone'

Hi,
I am currently working on reproducing the experiment, and I have encountered an issue related to a missing module, 'detectron.tools.standalone', which is referenced in the code. However, there is no such file or module within the Detectron package from the mentioned https://github.com/facebookresearch/Detectron repository.

Detectron.tools.standalone is mentioned in the blazeit/labelers/detectron_labeler.py file

Is 'detectron.tools.standalone' a custom modification or an external module? If it is a custom modification, I would appreciate guidance on where I can obtain the necessary code.

base_specializer.py - can not find the file named "collections" and the definition of "SingleVideoDecoder"

hi, when I read from collections import defaultdict in /blazeit/blazeit/specializers/base_specializer.py, I can not find any file named "collections". Can you share it?

I also can not find the definition of SingleVideoDecoder in base_specializer.py.

 def getX(self, dump=True, data_path='/lfs/1/ddkang/blazeit/data/'):
        if self.video_fname[-4:] == '.npy':
            X = np.load(self.video_fname, mmap_mode='r')
        elif self.video_fname[-4:] == '.mp4' or self.video_fname[-5:] == '.webm':
            # TODO: make swag parallel decode
            raise NotImplementedError
            _, json_fname = tempfile.mkstemp()
            self.vid_data.serialize(json_fname)
            bd = SingleVideoDecoder(json_fname, self.video_fname)
            X = bd.read()
           ....

Thank you!

README is outdated. Please update.

Hi,
I tried to follow the instruction to reproducing experiments, but I found out that the structure of the code did not match the instruction paths. I tried to run the script with the same name in another folder, and it gave out some bugs.

at step 3: the script run_counter.py is now in folder aggregation, not in folder counting anymore, and when I run it, it gave out bug:

File "/root/blazeit/blazeit/specializers/specializers.py", line 192, in getY
    Y[frame] = min(self.max_count, len(frame_to_rows[frame]))
IndexError: index 973488 is out of bounds for axis 0 with size 973488

Error on run EBS sampling (step 3 of Reproducing experiments section)

Hi,

I am trying to reproducing the experiments with the blazeit system, after faced the error from issue #6 and I can not fix it, I skip it and move to run the EBS sampling, then it gave another error, could you please help me with this too? Here is the step by step how did I run the experiment:

Reproduce problem:

  • Environment: prepared as requirements
  • Step 1: prepared jackson-town-square video and structure folders as the instruction. (succeed)
  • Step 2: Extract the videos into npy files by run command: python gen_small_vid.py --base_name jackson-town-square --date 2017-12-14 (succeed)
  • Step 3: run EBS sampling by run the command: python blazeit/aggregation/run_ebs_sampling.py --obj_name car --err_tol 0.01 --base_name jackson-town-square --test_date 2017-12-17 --train_date 2017-12-14 then it throw error as bellow:

Error:

Traceback (most recent call last):
File "blazeit/aggregation/run_ebs_sampling.py", line 96, in
main()
File "blazeit/aggregation/run_ebs_sampling.py", line 71, in main
Y_pred, Y_true = get_data(base_name, test_date, obj_name, data_path)
File "blazeit/aggregation/run_ebs_sampling.py", line 40, in get_data
trues = np.zeros(np.max(true_idx.index) + 1)
File "<array_function internals>", line 6, in amax
File "/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2621, in amax
keepdims=keepdims, initial=initial, where=where)
File "/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction
return reduction(axis=axis, out=out, **passkwargs)
TypeError: max() got an unexpected keyword argument 'out'

Error on reproduce the aggregation experiments (step 3 of Reproducing experiments section)

Hi,

I am trying to reproducing the experiments with the blazeit system, the environment setup and data preprocessing went well, but when I tried to reproduce the aggregation experiments, it throws out some error. I tried to fix it many times but I can not solve it. Could you please help me somehow? Here is the step by step how did I run the experiment

Reproduce problem:

  • Environment: prepared as requirements
  • step 1: prepared jackson-town-square video and structure folders as the instruction. (succeed)
  • step 2: Extract the videos into npy files by run command: python gen_small_vid.py --base_name jackson-town-square --date 2017-12-14 (succeed)
  • step 3: run the aggregation experiments and it has failed and gave the errors as bellow:
    python blazeit/aggregation/run_counter.py --base_name jackson-town-square --train_date 2017-12-14 --thresh_date 2017-12-16 --test_date 2017-12-17 --objects car --no-load_video --out_csv csvs/jackson-town-square-2017-12-17.csv

Error:

Traceback (most recent call last):

File "run_counter.py", line 54, in
main()
File "run_counter.py", line 46, in main
load_video=args.load_video
File "/root/blazeit/blazeit/aggregation/counter.py", line 129, in train_and_test
spec.load_data(selection='balanced', nb_train=150000)
File "/root/blazeit/blazeit/specializers/base_specializer.py", line 155, in load_data
t1, t2 = self.get_train_val(**kwargs)
File "/root/blazeit/blazeit/specializers/base_specializer.py", line 149, in get_train_val
X_train, X_val = split(X, train_inds, val_inds)
File "/root/blazeit/blazeit/specializers/base_specializer.py", line 137, in split
return Z[train_inds], Z[val_inds]
File "/opt/conda/lib/python3.6/site-packages/numpy/core/memmap.py", line 331, in getitem
res = super(memmap, self).getitem(index)
IndexError: index 973488 is out of bounds for axis 0 with size 973488

After re-run step 3 a few time, the error above passed itself, then another error appears:

Traceback (most recent call last): | 0/8915 [00:00<?, ?it/s] File "blazeit/aggregation/run_counter.py", line 54, in
main()
File "blazeit/aggregation/run_counter.py", line 46, in main
load_video=args.load_video
File "/root/blazeit/blazeit/aggregation/counter.py", line 133, in train_and_test
spec.train(silent=True)
File "/root/blazeit/blazeit/aggregation/counter.py", line 18, in train
super().train(**kwargs, epochs=[1, 0], lrs=[0.001, 0.001])
File "/root/blazeit/blazeit/specializers/specializers.py", line 203, in train
self._train(criterion, metric='topk', **kwargs)
File "/root/blazeit/blazeit/specializers/base_specializer.py", line 206, in _train
run_epoch(lrs[0], epochs[0])
File "/root/blazeit/blazeit/specializers/base_specializer.py", line 198, in run_epoch
silent=silent)
File "/root/blazeit/blazeit/specializers/pytorch_utils.py", line 163, in trainer
train_epoch(train_loader, model, criterion, optimizer, epoch, metric, silent=silent)
File "/root/blazeit/blazeit/specializers/pytorch_utils.py", line 100, in train_epoch
output = model(input_var)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 545, in call
result = self.forward(*input, **kwargs)
File "/root/blazeit/blazeit/specializers/resnet_simple.py", line 117, in forward
x = self.conv1(x)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 545, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 345, in forward
return self.conv2d_forward(input, self.weight)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 342, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size 16 3 3 3, expected input[16, 65, 3, 65] to have 3 channels, but got 65 channels instead

Then continue re-run a few time more, the first error appears again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.