GithubHelp home page GithubHelp logo

peterzhousz / timeception Goto Github PK

View Code? Open in Web Editor NEW

This project forked from noureldien/timeception

0.0 1.0 0.0 617 KB

Implementation of the paper: Timeception for Complex Action Recognition. Accepted as Oral Presentation at CVPR 2019

Home Page: https://arxiv.org/abs/1812.01289

License: GNU General Public License v3.0

Python 99.93% Shell 0.07%

timeception's Introduction

Timeception for Complex Action Recognition

Keras Keras Keras

This code repository is the implementation for the paper Timeception for Complex Action Recognition. We provide the implementation for 3 different libraries: keras, tensorflow and pytorch.

Timeception for Complex Action Recognition

Citation

Please consider citing this work using this BibTeX entry

@inproceedings{hussein2018timeception,
  title     = {Timeception for Complex Action Recognition},
  author    = {Hussein, Noureldien and Gavves, Efstratios and Smeulders, Arnold WM},
  booktitle = {CVPR},
  year      = {2019}
}

How to Use?

Keras

Using keras, we can define timeception as a sub-model. Then we use it along with another model definition. For example, here we define 4 timeception layers followed by a dense layer for classification.

from keras import Model
from keras.layers import Input, Dense
from nets.layers_keras import MaxLayer
from nets.timeception import Timeception

# define the timeception layers
timeception = Timeception(1024, n_layers=4)

# define network for classification
input = Input(shape=(128, 7, 7, 1024))
tensor = timeception(input)
tensor = MaxLayer(axis=(1, 2, 3))(tensor)
output = Dense(100, activation='softmax')(tensor)
model = Model(inputs=input, outputs=output)
model.summary()

This results in the model defined as:

Layer (type)  Output Shape              Param #   
================================================
(InputLayer)  (None, 128, 7, 7, 1024)   0         
(Timeception) (None, 8, 7, 7, 2480)     1494304   
(MaxLayer)    (None, 2480)              0         
(Dense)       (None, 100)               248100    
================================================
Total params: 1,742,404
Tensorflow

Using tensorflow, we can define timeception as a list of nodes in the computational graph. Then we use it along with another model definition. For example, here a functions defines 4 timeception layers. It takes the input tensor, feedforward it to the timeception layers and return the output tensor output.

import tensorflow as tf
from nets import timeception

# define input tensor
input = tf.placeholder(tf.float32, shape=(None, 128, 7, 7, 1024))

# feedforward the input to the timeception layers
tensor = timeception.timeception_layers(input, n_layers=4)

# the output is (?, 8, 7, 7, 2480)
print (tensor.get_shape())
PyTorch

Using pytorch, we can define timeception as a module. Then we use it along with another model definition. For example, here we define 4 timeception layers followed by a dense layer for classification..

import numpy as np
import torch as T
from nets import timeception_pytorch

# define input tensor
input = T.tensor(np.zeros((32, 1024, 128, 7, 7)), dtype=T.float32)

# define 4 layers of timeception
module = timeception_pytorch.Timeception(input.size(), n_layers=4)

# feedforward the input to the timeception layers 
tensor = module(input)

# the output is (32, 2480, 8, 7, 7)
print (tensor.size())

Installation

We use python 2.7.15, provided by Anaconda 4.6.2, and we depend on the following python packages.

  • Keras 2.2.4
  • Tensorflow 1.10.1
  • PyTorch 1.0.1

Training

Testing

Fine-tuning

Pretrained Models

Charades

We will add all pretrained models for Charades by the end of April. For testing, start with the script ./scripts/test_charades_timeception.sh. In order to change which baseline is uses for testing, set the -- config-file using on of the following options.

2D-ResNet-152

Timeception on top of 2D-ResNet-152 as backnone.

Config File Backbone TC Layers Frames mAP (%) Model
charades_r2d_tc3_f32.yaml R2D 3 32 30.37 Link
charades_r2d_tc3_f64.yaml R2D 3 64 31.25 Link
charades_r2d_tc4_f128.yaml R2D 4 128 31.82 Link
I3D

Timeception on top of ResNet-152 as backnone.

Config File Backbone TC Layers Frames mAP (%) Model
charades_i3d_tc3_f256.yaml I3D 3 256 33.89 Link
charades_i3d_tc3_f512.yaml I3D 3 512 35.46 Link
charades_i3d_tc4_f1024.yaml I3D 4 1024 37.20 Link
3D-ResNet-100

Timeception on top of 3D-ResNet-100 as backnone.

Config File Backbone TC Layers Frames mAP (%) Model
charades_r3d_tc4_f1024.yaml R3D 4 1024 41.1 Link

Kinetics 400

We will add all pretrained models for Kinetics 400 by the end of June.

License

The code and the models in this repo are released under the GNU 3.0 LICENSE.

timeception's People

Contributors

noureldien avatar

Watchers

 avatar

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.