Code Monkey home page Code Monkey logo

t-cnn's Introduction

T-CNN: Tubelets with Convolution Neural Networks

Introduction

The TCNN framework is a deep learning framework for object detection in videos. This framework was orginally designed for the ImageNet VID chellenge in ILSVRC2015.

Citing T-CNN

If you are using the T-CNN code in you project, please cite the following works.

@inproceedings{kang2016object,
  Title = {Object Detection from Video Tubelets with Convolutional Neural Networks},
  Author = {Kang, Kai and Ouyang, Wanli and Li, Hongsheng and Wang, Xiaogang},
  Booktitle = {CVPR},
  Year = {2016}
}
@article{kang2016tcnn,
  title={T-CNN: Tubelets with Convolutional Neural Networks for Object Detection from Videos},
  author={Kang, Kai and Li, Hongsheng and Yan, Junjie and Zeng, Xingyu and Yang, Bin and Xiao, Tong and Zhang, Cong and Wang, Zhe and Wang, Ruohui and Wang, Xiaogang and Ouyang, Wanli},
  journal={arXiv preprint},
  year={2016}
}

License

T-CNN is released under the MIT License.

ImageNet 2015 VID detection results

Track Validation Set Test Set Rank in ILSVRC2015
Provided 73.8 67.8 #1
Additional 77.0 69.7 #2

Installations

Prerequisites

  1. caffe with Python layer and pycaffe
  2. GNU Parallel
  3. matutils
  4. FCN tracker
  5. Matlab with python engine

Instructions

  1. Clone the repository and sub-repositories from GitHub, let $TCNN_ROOT represents the root directory of the repository.

        $ # clone the repository
        $ git clone --recursive https://github.com/myfavouritekk/T-CNN.git
        $ cd $TCNN_ROOT
        $ # checkout the ImageNet 2015 VID branch
        $ git checkout ilsvrc2015vid
  2. Compilation for vdetlib

        $ cd $TCNN_ROOT/vdetlib
        $ make
        $ export PYTHONPATH=$TCNN_ROOT/vdetlib:$PYTHONPATH
  3. Download and install caffe in the External directory

        $ git clone https://github.com/BVLC/caffe.git External/caffe
        $ # modify `Makefile.config` and build with Python layer and pycaffe
        $ # detailed instruction, please follow http://caffe.berkeleyvision.org/installation.html
        $ export PYTHONPATH=$TCNN_ROOT/External/caffe/python:$PYTHONPATH
  4. Download a modified version of FCN Tracker originally developed by Lijun Wang et. al.

        $ git clone --recursive -b T-CNN https://github.com/myfavouritekk/FCNT External/fcn_tracker_matlab
        $ # compile the caffe-fcn_tracking and configure FCNT

Demo

  1. Extract the sample data and still-image detection results

        $ cd $TCNN_ROOT
        $ unzip sample_data.zip -d data/
  2. Generate optical flow for the videos

        $ mkdir ./data/opt_flow
        $ ls ./data/frames |
            parallel python tools/data_proc/gen_optical_flow.py ./data/frames/{} ./data/opt_flow/{} --merge
  3. Multi-context suppression and motion-guided propagation in Matlab

        >> addpath(genpath('tools/mcs_mgp'));
        >> mcs_mgp('data/opt_flow', 'data/scores', 'data/mcs_mgp')
  4. Tubelet tracking and re-scoring

        $ # generate .vid protocol files
        $ ls data/frames | parallel python vdetlib/tools/gen_vid_proto_file.py {} $PWD/data/frames/{} data/vids/{}.vid
        $ # tracking from raw detection files
        $ find data/vids -type f -name *.vid | parallel -j1 python tools/tracking/greedy_tracking_from_raw_dets.py {} data/mcs_mgp/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow/{/.} data/tracks/{/.} --thres 3.15 --max_frames 100 --num 30
        $ # spatial max-pooling
        $ find data/vids -type f | parallel python tools/scoring/tubelet_raw_dets_max_pooling.py {} data/tracks/{/.} data/mcs_mgp/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow/{/.} data/score_proto/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow_max_pooling/{/.} --overlap_thres 0.5
  5. Tubelet visualization

        $ python tools/visual/show_score_proto.py data/vids/ILSVRC2015_val_00007011.vid data/score_proto/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow_max_pooling/ILSVRC2015_val_00007011/ILSVRC2015_val_00007011.airplane.score

Beyond demo

  1. Optical flow extraction

        $ python tools data_proc/gen_optical_flow.py -h
  2. vdetlib for tracking and rescoring

  3. Visualization tools in tools/visual.

Known Issues

  1. Matlab engines may stall after long periods of tracking. Please consider to kill the certain matlab session to continue.

To-do list

  • Tubelet Bayesian classifier

t-cnn's People

Contributors

cysu avatar myfavouritekk 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar

t-cnn's Issues

A error in demo step.2

I meet a error when I test the demo step.2 "Generate optical flow for the videos"

Academic tradition requires you to cite works you base your article on.
When using programs that use GNU Parallel to process data for publication
please cite:

O. Tange (2011): GNU Parallel - The Command-Line Power Tool,
;login: The USENIX Magazine, February 2011:42-47.

This helps funding further development; AND IT WON'T COST YOU A CENT.
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.

To silence the citation notice: run 'parallel --citation'.

Traceback (most recent call last):
File "tools/data_proc/gen_optical_flow.py", line 3, in
import cv2

ImportError: No module named cv2

ubuntu14.04 Python2.7 MATLAB2015a
Caffe and FCN-tracker are fine.

By the way, how to deal with "matutils" ? I put it in $TCNN_ROOT,is it right?

some questions when running demo

when i run the demo in step 4. “Tubelet tracking and re-scoring:……
$ find data/vids -type f -name *.vid | parallel -j1 python tools/tracking/greedy_tracking_from_raw_dets.py {} data/mcs_mgp/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow/{/.} data/tracks/{/.} --thres 3.15 --max_frames 100 --num 30”
I got an error :
"Traceback (most recent call last):
File "tools/tracking/greedy_tracking_from_raw_dets.py", line 46, in
eng = matlab.engine.start_matlab('-nodisplay -nojvm -nosplash -nodesktop')
TypeError: start_matlab() takes no arguments (1 given)"
I have no idea to solve it, so looking forward to getting your help.

Cannot find caffe.* in fcn_tracker.m (follow the instruction compiling)

Following the instruction, I compiled matcaffe for caffe_fcn, but it can not pass the "Demo->4,Tubelet tracking and re-scoring".

It always stopped at fcn_tracker.m for "can not find caffe or caffe.* ". I haven't meet this problem in original FCN tracking.

Do I need to addpath to change matlab work path? anyone can give a help?

caffemodel and prototxt files trained on ILSVRC VID dataset (30 classes)

Is it possible to share the caffemodel and prototxt files trained on ILSVRC VID dataset (30 classes) for Fast-RCNN ?
I know its possible to fine-tune the Network starting from 1000 classes / 200 classes as mentioned in the paper.
However, is there a off the shelf Network trained with 30 classes ?

implementation_error

Hello,Kai KANG
Sincerely sorry for the interruption. Recently I tried to run this code. But there is an error occuring in **** File "./vdetlib/vdet/track.py", line 200, in greedily_track_from_raw_dets****, it says **det_info = np.asarray(sorted(det_info[:, [0,1,2,3,4,4+class_idx]], IndexError: too many indices
** And I couldn't find out why. It would be much helpful with your enlighting reply.
Looking forward to your reply

Fine Tuning

How to fine tune your model?
I don't have sufficient data to retrain your model from scratch.
I want to fine tune your model on my data which has only two classes ?

why still image detection score is not between [0,1]?

dear @myfavouritekk, Still image detection outputs are bounding box and probability corresponding to different classes, and thus the scores should between [0,1]. Why scores in your example data is not?

Another question
Bounding boxes output from Faster RCNN or other Detecion Program shouldn't be as many as your example data. Did you keep most of the output bounding boxes with a low score threshold? Or the bounding boxes just come from RPN output?

Thank you!

File "data/frames/000075.JPEG" does not exists while running greedy_tracking_from_raw_dets.py

While running this command
find data/vids -type f -name *.vid | python tools/tracking/greedy_tracking_from_raw_dets.py data/vids/{}.vid data/mcs_mgp/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow/ data/tracks/ --thres 3.15 --max_frames 100 --num 30

I am getting this error:

data/mcs_mgp/window_size_7_time_step_1_top_ratio_0.000300_top_bonus_0.400000_optflow/ data/tracks/ --thres 3.15 --max_frames 100 --num 30
[2018-04-04 09:04:15,303 4239 greedy_tracking_from_raw_dets.py:42 INFO] Video: {}
[2018-04-04 09:04:18,369 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking turtle...
27
[2018-04-04 09:04:18,601 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:18,602 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class turtle
[2018-04-04 09:04:18,602 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking antelope...
2
[2018-04-04 09:04:18,818 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:18,820 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class antelope
[2018-04-04 09:04:18,820 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking bicycle...
4
[2018-04-04 09:04:19,042 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:19,043 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class bicycle
[2018-04-04 09:04:19,043 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking lion...
16
[2018-04-04 09:04:19,265 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:19,267 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class lion
[2018-04-04 09:04:19,267 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking motorcycle...
19
[2018-04-04 09:04:19,491 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:19,493 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class motorcycle
[2018-04-04 09:04:19,493 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking cattle...
8
[2018-04-04 09:04:19,718 4239 track.py:219 INFO] Upon low confidence: total 0 tracks
[2018-04-04 09:04:19,719 4239 greedy_tracking_from_raw_dets.py:63 WARNING] {} has no tracks for class cattle
[2018-04-04 09:04:19,719 4239 greedy_tracking_from_raw_dets.py:58 INFO] Tracking airplane...
1
[2018-04-04 09:04:19,895 4239 track.py:222 INFO] tracking top No.0 in {}
[2018-04-04 09:04:19,896 4239 common.py:341 DEBUG] Use opened Matlab session: <matlab.engine.matlabengine.MatlabEngine object at 0x7f4b183e0690>
Error using imread (line 349)
File "data/frames/000075.JPEG" does not exist.

Error in fcn_tracker (line 11)
im1 = double(imread(im1_name));

[2018-04-04 09:04:21,946 4239 common.py:341 DEBUG] Use opened Matlab session: <matlab.engine.matlabengine.MatlabEngine object at 0x7f4b03d6f990>
Error using imread (line 349)
File "data/frames/000075.JPEG" does not exist.

Error in fcn_tracker (line 11)
im1 = double(imread(im1_name));

Traceback (most recent call last):
  File "tools/tracking/greedy_tracking_from_raw_dets.py", line 61, in <module>
    cls_idx, opts)
  File "./vdetlib/vdet/track.py", line 234, in greedily_track_from_raw_dets
    new_tracks = track_method(vid_proto, anchor_frame_id, anchor_bbox, opts)
  File "./vdetlib/vdet/track.py", line 82, in fcn_tracker
    [matlab.double(bbox),] + fw_frames + [opts.gpu,], opts.engine)
  File "./vdetlib/utils/common.py", line 345, in matlab_engine
    result = func(input_list)
  File "/usr/local/lib/python2.7/dist-packages/matlab/engine/matlabengine.py", line 84, in __call__
    _stderr).result()
  File "/usr/local/lib/python2.7/dist-packages/matlab/engine/futureresult.py", line 106, in result
    self._future,self._nargout, None, out=self._out, err=self._err)
matlab.engine.MatlabExecutionError: 
  File /usr/local/MATLAB/R2015b/toolbox/matlab/imagesci/imread.p, line 349, in imread

  File /home/eswar/T-CNN/External/fcn_tracker_matlab/fcn_tracker.m, line 11, in fcn_tracker
File "data/frames/000075.JPEG" does not exist.

The file 000075.JPEG is there in the data/frames directory. But I don't know why it is not looking into it.
The fcn_tracker file can be found here

How can we statistics mAP after MGP?

dear author,
Thank you did a great job! I have thought about using optical flow to suppress false negative on object detection mission.But I am confused with mAP calculation, chould you tell me the formulation about mAP?
When I use caffe run some detection code like SSD,fast-RCNN,it chould calculate mAP when the forward propagation finished, I think MGP is a idea after CNN-net,so how can we statistics mAP again?Meanwhile, did this algorithm improve either mAP or recall. I thought is should be recall.
thanks a lot!!!!!

matlab.engine.EngineError: MATLAB function cannot be evaluated

[2016-07-26 20:49:44,869 24261 greedy_tracking_from_raw_dets.py:58 INFO] Tracking lion...
[2016-07-26 20:49:45,243 24261 track.py:219 INFO] Upon low confidence: total 0 tracks
[2016-07-26 20:49:45,244 24261 greedy_tracking_from_raw_dets.py:63 WARNING] ILSVRC2015_val_00007011 has no tracks for class lion
[2016-07-26 20:49:45,244 24261 greedy_tracking_from_raw_dets.py:58 INFO] Tracking motorcycle...
[2016-07-26 20:49:45,617 24261 track.py:219 INFO] Upon low confidence: total 0 tracks
[2016-07-26 20:49:45,618 24261 greedy_tracking_from_raw_dets.py:63 WARNING] ILSVRC2015_val_00007011 has no tracks for class motorcycle
[2016-07-26 20:49:45,618 24261 greedy_tracking_from_raw_dets.py:58 INFO] Tracking cattle...
[2016-07-26 20:49:45,990 24261 track.py:219 INFO] Upon low confidence: total 0 tracks
[2016-07-26 20:49:45,991 24261 greedy_tracking_from_raw_dets.py:63 WARNING] ILSVRC2015_val_00007011 has no tracks for class cattle
[2016-07-26 20:49:45,991 24261 greedy_tracking_from_raw_dets.py:58 INFO] Tracking airplane...
[2016-07-26 20:49:46,336 24261 track.py:222 INFO] tracking top No.0 in ILSVRC2015_val_00007011
[2016-07-26 20:49:46,336 24261 common.py:341 DEBUG] Use opened Matlab session: <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e308fbcd0>
[2016-07-26 20:50:08,061 24261 common.py:341 DEBUG] Use opened Matlab session: <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e308fbcd0>
[2016-07-26 20:50:09,544 24261 common.py:348 ERROR] Existing engine no response: <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e308fbcd0>
[2016-07-26 20:50:13,866 24261 common.py:341 DEBUG] Use opened Matlab session: <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e711e4710>
[2016-07-26 20:50:29,874 24261 common.py:348 ERROR] Existing engine no response: <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e711e4710>
Traceback (most recent call last):
File "tools/tracking/greedy_tracking_from_raw_dets.py", line 61, in
cls_idx, opts)
File "./vdetlib/vdet/track.py", line 234, in greedily_track_from_raw_dets
new_tracks = track_method(vid_proto, anchor_frame_id, anchor_bbox, opts)
File "./vdetlib/vdet/track.py", line 82, in fcn_tracker
[matlab.double(bbox),] + fw_frames + [opts.gpu,], opts.engine)
File "./vdetlib/utils/common.py", line 349, in matlab_engine
raise e
matlab.engine.EngineError: MATLAB function cannot be evaluated
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(_targs, *_kargs)
File "/home/tju/.local/lib/python2.7/site-packages/matlab/engine/init.py", line 186, in exit_engines
eng().exit()
File "/home/tju/.local/lib/python2.7/site-packages/matlab/engine/matlabengine.py", line 246, in exit
pythonengine.closeMATLAB(self.__dict
["_matlab"])
SystemError: MATLAB process cannot be terminated.
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(_targs, *_kargs)
File "/home/tju/.local/lib/python2.7/site-packages/matlab/engine/init.py", line 186, in exit_engines
eng().exit()
File "/home/tju/.local/lib/python2.7/site-packages/matlab/engine/matlabengine.py", line 246, in exit
pythonengine.closeMATLAB(self.__dict
["_matlab"])
SystemError: MATLAB process cannot be terminated.
Exception SystemError: 'MATLAB process cannot be terminated.' in <bound method MatlabEngine.del of <matlab.engine.matlabengine.MatlabEngine object at 0x7f1e711e4710>> ignored

doses anyone happen to this? please let me know your solution, Thanks!

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.