Skip to content

Commit

Permalink
Update json template frame size, fix num_clip=0 bug (#3)
Browse files Browse the repository at this point in the history
* Update json template frame size, fix num_clip=0 bug
  Update README.md with link to wiki
  • Loading branch information
ehofesmann authored and zeonzir committed Aug 13, 2019
1 parent 0326d61 commit 326c42c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

A platform for quick and easy development of deep learning networks for recognition and detection in videos. Includes popular models like C3D and SSD.

Check out our [wiki!](https://github.com/MichiganCOG/ViP/wiki)

## Implemented Models and their performance

### Recognition
Expand All @@ -26,7 +28,7 @@ A platform for quick and easy development of deep learning networks for recognit
* [Development](#development)
* [Add a Model](#add-a-model)
* [Add a Dataset](#add-a-dataset)
* [Version History](#version-history)
* [FAQ](#faq)

## Configured Datasets
| Dataset | Task(s) |
Expand Down Expand Up @@ -88,6 +90,9 @@ Ex: From the root directory of ViP, train the action recognition network C3D on
```
python train.py --cfg_file models/c3d/config_train.yaml
```

Additional examples can be found on our [wiki.](https://github.com/MichiganCOG/ViP/wiki)

## Development

New models and datasets can be added without needing to rewrite any training, evaluation, or data loading code.
Expand All @@ -103,6 +108,8 @@ To add a new model:

Examples of previously implemented models can be found [here](https://github.com/MichiganCOG/ViP/tree/master/models).

Additional information can be found on our [wiki.](https://github.com/MichiganCOG/ViP/wiki)

### Add a Dataset

To add a new dataset:
Expand All @@ -114,3 +121,8 @@ To add a new dataset:
* Complete `__init__` and `__getitem__` functions
* Example skeleton dataset can be found [here](https://github.com/MichiganCOG/ViP/blob/master/datasets/templates/dataset_template.py)

Additional information can be found on our [wiki.](https://github.com/MichiganCOG/ViP/wiki)

### FAQ

A detailed FAQ can be found on our [wiki](https://github.com/MichiganCOG/ViP/wiki/FAQ).
8 changes: 7 additions & 1 deletion datasets/abstract_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _extractClips(self, video):
if self.num_clips < 0:
if len(video) >= self.clip_length:
final_video = [video[_idx] for _idx in np.linspace(0, len(video)-1, self.clip_length, dtype='int32')]
final_video = [final_video]

else:
# Loop if insufficient elements
Expand All @@ -80,6 +81,7 @@ def _extractClips(self, video):
indices = indices[np.linspace(0, len(indices)-1, self.clip_length, dtype='int32')]

final_video = [video[_idx] for _idx in indices]
final_video = [final_video]


# END IF
Expand All @@ -103,6 +105,7 @@ def _extractClips(self, video):
indices = indices[:self.clip_length]

final_video = [video[_idx] for _idx in indices]
final_video = [final_video]

# END IF

Expand All @@ -114,6 +117,7 @@ def _extractClips(self, video):
indices = np.arange(indices, indices + self.clip_length).astype('int32')

final_video = [video[_idx] for _idx in indices]
final_video = [final_video]

else:
indices = np.ceil(self.clip_length/float(len(video)))
Expand All @@ -125,17 +129,19 @@ def _extractClips(self, video):
indices = indices[index:index + self.clip_length]

final_video = [video[_idx] for _idx in indices]
final_video = [final_video]

# END IF

else:
final_video = video[:self.clip_length]
final_video = [final_video]

# END IF

# END IF

return [final_video]
return final_video



Expand Down
4 changes: 2 additions & 2 deletions datasets/templates/action_recognition_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
"frames (list)": [
{
"frame_size (int, int)": "(WIDTH,HEIGHT)",
"img_path (str)": "FRAME_PATH",
"actions (list)": [
{
Expand All @@ -11,6 +10,7 @@
]
}
],
"frame_size (int, int)": "(WIDTH,HEIGHT)",
"base_path (str)": "BASE_VID_PATH"
}
]
]
6 changes: 3 additions & 3 deletions datasets/templates/detection_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
"frames (list)": [
{
"frame_size (int, int)": "(WIDTH,HEIGHT)",
"img_path (str)": "FRAME_PATH",
"objs (list)": [
{
Expand All @@ -14,6 +13,7 @@
]
}
],
"base_path (str)": "BASE_VID_PATH"
"base_path (str)": "BASE_VID_PATH",
"frame_size (int, int)": "(WIDTH,HEIGHT)"
}
]
]

0 comments on commit 326c42c

Please sign in to comment.