Skip to content

Commit

Permalink
Quick fix for data pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
eborboihuc committed Jul 30, 2017
1 parent 5c3e697 commit 3e96c63
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 21 deletions.
24 changes: 17 additions & 7 deletions README.md
Expand Up @@ -29,19 +29,21 @@ Paper: [High resolution](https://drive.google.com/file/d/0B2dg5RanEUBQRkJYZDc1Mm
You may choose the ideal version to use

- Clone [this](https://github.com/eborboihuc/Deep360Pilot-CVPR17) repo and [another](https://github.com/yenchenlin/Deep360Pilot-optical-flow) for formating the input data:

```bash
git clone git@github.com:eborboihuc/Deep360Pilot-CVPR17.git
git clone http://github.com/eborboihuc/Deep360Pilot-CVPR17.git

cd Deep360Pilot/misc

git clone git@github.com:yenchenlin/Deep360Pilot-optical-flow.git
git clone http://github.com/yenchenlin/Deep360Pilot-optical-flow.git
```
- Download our [dataset](#dataset) and [pre-trained model](#pre-trained-model)

After run the scripts
```bash
python require.py
```
You can download our model and dataset and place it under `./checkpoint` and `./data`, respectively.
Please download our model and dataset and place it under `./checkpoint` and `./data`, respectively.


# Usage
Expand Down Expand Up @@ -73,13 +75,21 @@ Please download the trained model [here](https://drive.google.com/uc?export=down
You can use `--model {model_path}` in `main.py` to load the model.

## Dataset
If you want to test on our dataset, please download the dataset [here](https://drive.google.com/uc?export=download&id=0B9wE6h4m--wjWnF3LV9WUXdZMzA) and place it under `./data`.
You can use code from [here](https://github.com/yenchenlin/Deep360Pilot-optical-flow) to convert it to our input format.

## Author
### Pipeline testing
We provide a small testing clip-based datafile. Please download it [here](https://drive.google.com/uc?export=download&id=0B9wE6h4m--wjaTNPYUk4NkM0UDA). And you can use this toy datafile to go though our data process pipeline.

### Testing on our *batch-based dataset* for accuracy and smoothness
If you want to reproduce the results on our dataset, please download the dataset [here](https://drive.google.com/uc?export=download&id=0B9wE6h4m--wjWnF3LV9WUXdZMzA) and place it under `./data`.

### Testing on our *clip-based dataset* for generating trajectories
Please download the *clip-based dataset* [here](https://drive.google.com/uc?export=download&id=0B9wE6h4m--wjZzJkZnNLZW1BNE0)
And then use code from [here](https://github.com/yenchenlin/Deep360Pilot-optical-flow) to convert it to our input format.

# Author
Hou-Ning Hu / [@eborboihuc](https://eborboihuc.github.io/) and Yen-Chen Lin / [@yenchenlin](https://yclin.me)

## Cite
# Cite
If you find our code useful for your research, please cite
```bibtex
@InProceedings{Hu_2017_CVPR,
Expand Down
30 changes: 27 additions & 3 deletions misc/README.md
@@ -1,16 +1,40 @@
# 360 videos data pipeline

## How to Run?
1. Make sure `dataset.csv` is placed in the repository, which contains the metadata of our dataset. And also place `OF_360` repository in the current location.

2. Parse `dataset.csv` to generate `metadata.npy`, run:
*NOTE*: You can use this [example](https://drive.google.com/uc?export=download&id=0B9wE6h4m--wjaTNPYUk4NkM0UDA) file to go through data pipeline

1. Make sure `dataset.csv` is placed in the repository, which contains the metadata of our dataset.
And also place `Deep360Pilot-optical-flow` repository in the current location.

2. Make sure the generated feature `roisavg.npy`, `roislist.npy` and every video frames placed at `data/feature_{DOMAIN}_{N_BOXES}boxes` and `data/frame_{DOMAIN}`

3. Execute `run.sh {DOMAIN} {N_BOXES}` once and you can get the ideal data format under `data/feature_{DOMAIN}_{N_BOXES}boxes`

`./run.sh test 16`



## Details inside run.sh

1. Parse `dataset.csv` to generate `metadata.npy`, run:

`python parse_csv.py`

3. Split raw label according to each clip which has length 50, run:
2. Split raw label according to each clip which has length 50, run:

`python parse_raw_label.py`

3. Deep360Pilot-Optical-Flow will generate ideal data input format and also hof.npy files, see `run.sh`:

```bash
python Deep360Pilot-optical-flow/compute_video_flow.py -d $DOMAIN
python Deep360Pilot-optical-flow/divide_area_motion_salient_boxes.py -d $DOMAIN -b $N_BOXES
python Deep360Pilot-optical-flow/pruned_box_features.py -d $DOMAIN -b $N_BOXES
python Deep360Pilot-optical-flow/get_motion_features.py -d $DOMAIN -b $N_BOXES
python Deep360Pilot-optical-flow/hist_of_opt_flow/get_hof.py -d $DOMAIN -b $N_BOXES
```

4. Generate batches, run:

`python gen_batch.py`
Expand Down
4 changes: 2 additions & 2 deletions misc/config.py
@@ -1,5 +1,5 @@
import os

ROOT_PATH = os.path.abspath(os.path.join(os.getcwd(), os.path.pardir))
FEATURE_PATH = os.path.join(ROOT_PATH, 'newData')
BATCH_PATH = os.path.join(ROOT_PATH, 'dataset')
BATCH_PATH = os.path.abspath(os.path.join(os.getcwd(), 'dataset'))
FEATURE_PATH = os.path.join(ROOT_PATH, 'data')
40 changes: 31 additions & 9 deletions misc/run.sh
Expand Up @@ -8,22 +8,44 @@ fi
DOMAIN=${1}
N_BOXES=${2}

# Function
echo_time () {
echo [$(date)] ${1}
}

# Mkdir
_dirs=('dataset' 'metadata')
for dirname in "${_dirs[@]}"
do
if [ ! -d ${dirname} ]; then
echo_time "mkdir ${dirname}"
mkdir ${dirname}
else
echo_time "${dirname} exist"
fi
done

python parse_csv.py -d $DOMAIN

# """ In case you want to label new domain """
#sudo python parse_raw_label.py -d $DOMAIN -b $N_BOXES
#sudo python one_hot_convert.py -m data -d $DOMAIN -b $N_BOXES

#python parse_raw_label.py -d $DOMAIN -b $N_BOXES
#python one_hot_convert.py -m data -d $DOMAIN -b $N_BOXES

python OF_360/divide_area_motion_salient_boxes.py -d $DOMAIN -b $N_BOXES
python OF_360/pruned_box_features.py -d $DOMAIN -b $N_BOXES
python OF_360/get_motion_features.py -d $DOMAIN -b $N_BOXES
python OF_360/hist_of_opt_flow/get_hof.py -d $DOMAIN -b $N_BOXES
# """ Convert flow and apply to features """
echo_time "python Deep360Pilot-optical-flow/compute_video_flow.py -d $DOMAIN"
python Deep360Pilot-optical-flow/compute_video_flow.py -d $DOMAIN
echo_time "python Deep360Pilot-optical-flow/divide_area_motion_salient_boxes.py -d $DOMAIN -b $N_BOXES"
python Deep360Pilot-optical-flow/divide_area_motion_salient_boxes.py -d $DOMAIN -b $N_BOXES
echo_time "python Deep360Pilot-optical-flow/pruned_box_features.py -d $DOMAIN -b $N_BOXES"
python Deep360Pilot-optical-flow/pruned_box_features.py -d $DOMAIN -b $N_BOXES
echo_time "python Deep360Pilot-optical-flow/get_motion_features.py -d $DOMAIN -b $N_BOXES"
python Deep360Pilot-optical-flow/get_motion_features.py -d $DOMAIN -b $N_BOXES
echo_time "python Deep360Pilot-optical-flow/hist_of_opt_flow/get_hof.py -d $DOMAIN -b $N_BOXES"
python Deep360Pilot-optical-flow/hist_of_opt_flow/get_hof.py -d $DOMAIN -b $N_BOXES


# """ In case you need to generate test batches """
#cd batch_data/$DOMAIN
#cd ../..
#cd data/${DOMAIN}_${N_BOXES}
#python mkdir.py -d $DOMAIN
#python gen_batch.py -d $DOMAIN -b $N_BOXES
#python test_gen_batch.py -d $DOMAIN -b $N_BOXES
14 changes: 14 additions & 0 deletions require.py
Expand Up @@ -14,4 +14,18 @@
if os.path.isdir(os.path.join(root, 'misc/data')) == False:
os.symlink(os.path.join(root, 'data'), os.path.join(root, 'misc/data'))

cmd='wget --no-check-certificate "https://drive.google.com/uc?export=download&id={ID}" -O {LOCAL_FILE_NAME}'
show='https://drive.google.com/uc?export=download&id={ID} and place it at {LOCAL_FILE_NAME}'

print "Please Download these files:"

print show.format(**{'ID': '0B9wE6h4m--wjNWdFbnVYbG9kNm8', 'LOCAL_FILE_NAME': 'checkpoint/Deep360Pilot-model.zip'})
#os.system(cmd.format(**{'ID': '0B9wE6h4m--wjNWdFbnVYbG9kNm8', 'LOCAL_FILE_NAME': 'checkpoint/Deep360Pilot-model.zip'}))
print show.format(**{'ID': '0B9wE6h4m--wjaTNPYUk4NkM0UDA', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-test.zip'})
#os.system(cmd.format(**{'ID': '0B9wE6h4m--wjaTNPYUk4NkM0UDA', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-test.zip'}))
print show.format(**{'ID': '0B9wE6h4m--wjWnF3LV9WUXdZMzA', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-feature.zip'})
#os.system(cmd.format(**{'ID': '0B9wE6h4m--wjWnF3LV9WUXdZMzA', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-feature.zip'}))
print show.format(**{'ID': '0B9wE6h4m--wjZzJkZnNLZW1BNE0', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-batch-feature.zip'})
#os.system(cmd.format(**{'ID': '0B9wE6h4m--wjZzJkZnNLZW1BNE0', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-batch-feature.zip'}))
print show.format(**{'ID': '0B9wE6h4m--wjSXVYblBWNktacFk', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-label.zip'})
#os.system(cmd.format(**{'ID': '0B9wE6h4m--wjSXVYblBWNktacFk', 'LOCAL_FILE_NAME': 'data/Deep360Pilot-label.zip'}))

0 comments on commit 3e96c63

Please sign in to comment.