Code Monkey home page Code Monkey logo

hart's Introduction

Hierarchical Attentive Recurrent Tracking

This is an official Tensorflow implementation of single object tracking in videos by using hierarchical attentive recurrent neural networks, as presented in the following paper:

A. R. Kosiorek, A. Bewley, I. Posner, "Hierarchical Attentive Recurrent Tracking", NIPS 2017.

Installation

Install Tensorflow v1.1 and the following dependencies (using pip install -r requirements.txt (preferred) or pip install [package]):

  • matplotlib==1.5.3
  • numpy==1.12.1
  • pandas==0.18.1
  • scipy==0.18.1

Demo

The notebook scripts/demo.ipynb contains a demo, which shows how to evaluate tracker on an arbitrary image sequence. By default, it runs on images located in imgs folder and uses a pretrained model. Before running the demo please download AlexNet weights first (described in the Training section).

Data

  1. Download KITTI dataset from here. We need left color images and tracking labels.
  2. Unpack data into a data folder; images should be in an image folder and labels should be in a label folder.
  3. Resize all the images to (heigh=187, width=621) e.g. by using the scripts/resize_imgs.sh script.

Training

  1. Download the AlexNet weights:

    • Execute scripts/download_alexnet.sh or
    • Download the weights from here and put the file in the checkpoints folder.
  2. Run

     python scripts/train_hart_kitti.py --img_dir=path/to/image/folder --label_dir=/path/to/label/folder
    

The training script will save model checkpoints in the checkpoints folder and report train and test scores every couple of epochs. You can run tensorboard in the checkpoints folder to visualise training progress. Training should converge in about 400k iterations, which should take about 3 days. It might take a couple of hours between logging messages, so don't worry.

Evaluation on KITTI dataset

The scripts/eval_kitti.ipynb notebook contains the code necessary to prepare (IoU, timesteps) curves for train and validation set of KITTI. Before running the evaluation:

  • Download AlexNet weights (described in the Training section).
  • Update image and label folder paths in the notebook.

Citation

If you find this repo useful in your research, please consider citing:

@inproceedings{Kosiorek2017hierarchical,
   title = {Hierarchical Attentive Recurrent Tracking},
   author = {Kosiorek, Adam R and Bewley, Alex and Posner, Ingmar},
   booktitle = {Neural Information Processing Systems},
   url = {http://www.robots.ox.ac.uk/~mobile/Papers/2017NIPS_AdamKosiorek.pdf},
   pdf = {http://www.robots.ox.ac.uk/~mobile/Papers/2017NIPS_AdamKosiorek.pdf},
   year = {2017},
   month = {December}
}

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Release Notes

Version 1.0

  • Original version from the paper. It contains the KITTI tracking experiment.

hart's People

Contributors

abewley avatar akosiorek avatar xmyqsh 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

hart's Issues

ValueError: invalid literal for int() with base 10: 'training'

get the error:
Traceback (most recent call last):
File "/home/cbl/PycharmProjects/hart-master/scripts/train_hart_kitti.py", line 141, in
truncated_threshold=1., occluded_threshold=1, reverse=True, mirror=True)
File "/home/cbl/PycharmProjects/hart-master/scripts/../hart/data/kitti/tools.py", line 475, in get_data
truncated_threshold=truncated_threshold, occluded_threshold=occluded_threshold)
File "/home/cbl/PycharmProjects/hart-master/scripts/../hart/data/kitti/parser.py", line 226, in init
img_folder_or_paths = self._get_img_paths()
File "/home/cbl/PycharmProjects/hart-master/scripts/../hart/data/kitti/parser.py", line 252, in _get_img_paths
folders = sorted(folders, key=lambda x: int(os.path.basename(x).split('.')[0]))
File "/home/cbl/PycharmProjects/hart-master/scripts/../hart/data/kitti/parser.py", line 252, in
folders = sorted(folders, key=lambda x: int(os.path.basename(x).split('.')[0]))
ValueError: invalid literal for int() with base 10: 'training'
('parser=', ArgumentParser(prog='train_hart_kitti.py', usage=None, description=None, version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True))
('args.img_dir=', '/home/cbl/PycharmProjects/hart-master/KITTI_resize/data_tracking_image_2')
('args.label_dir=', '/home/cbl/PycharmProjects/hart-master/KITTI_resize/data_tracking_label_2')
('args.alexnet_dir=', '/home/cbl/PycharmProjects/hart-master/checkpoints')

could you give the example of the img_folder, label_folder, train_fraction, img_size?
I think my path is wrong

ImportError: No module named 'component'?

Hi! when I ready to run train_hart_kitti.py script, there is a wrong msg "No module named 'component'
".The whole code is as below:

Traceback (most recent call last):
File "../hart/scripts/train_hart_kitti.py", line 34, in <module>
from hart.data.kitti.tools import get_data
File "../hart/scripts/../hart/data/kitti/tools.py", line 28, in <module>
import neurocity as nct
File "../hart/scripts/../neurocity/__init__.py", line 22, in <module>
from component.model.base import train_mode,test_mode,mode
ImportError: No module named 'component'

ImportError: No module named core_rnn_cell_impl

Hi,
I'm using tensorflow 1.2.1 an i get the following error:

`ImportErrorTraceback (most recent call last)
in ()
9 from hart.data.kitti.tools import get_data
10 from hart.model import util
---> 11 from hart.model.attention_ops import FixedStdAttention
12 from hart.model.eval_tools import log_norm, log_ratios, log_values, make_expr_logger
13 from hart.model.tracker import HierarchicalAttentiveRecurrentTracker as HART

/home/wscuser/notebooks/hart/hart/model/attention_ops.py in ()
22 import numpy as np
23 import tensorflow as tf
---> 24 from tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl import LSTMCell
25 from tensorflow.python.ops.rnn_cell_impl import _RNNCell as RNNCell
26 from tensorflow.python.util import nest

ImportError: No module named core_rnn_cell_impl`

OTB

Hi,
Have you done an experiment on the OTB or VOT dataset?

Issue in /neurocity/data/store.py

Hello,

I met an error when running the training script. The error is below. I added the code to print out the value of len(v) and len(self).
/neurocity/data/store.py", line 87, in reset_data
assert len(v) == len(self), (len(v), len(self))
AssertionError: (1, 0)

Thanks!

appearance attention

can the appearance attention replaced by saliency detetion?
what is the appearance attention?

scripts/demo.ipynb

where is the result when I run scripts/demo.ipynb?I found nothing
thanks

demo.ipynb

why only track the small car , not the left big car?

how are the bounding boxes in the labels read?

We are trying to run your code on another dataset with diffrenet dimension images, however, we get wrong bounding boxes. we are assuming you scale down and/or change coordinates of the bounding boxes in the labels, would you please explain how did you use bounding boxes coordinates?
Also, when you use the kitti datset the bounding boxes coordinates seems to be decimal, wuold you please explain how you read them?
Thank you so much.

demo.ipynb import issues

Hi,
I have a problem running the demo:
ImportError Traceback (most recent call last)
in ()
7
8 from hart.data import disp
----> 9 from hart.data.kitti.tools import get_data
10 from hart.model import util
11 from hart.model.attention_ops import FixedStdAttention

C:\Program Files\Anaconda3\Lib\site-packages\hart\hart\data\kitti\tools.py in ()
26 import tensorflow as tf
27
---> 28 import neurocity as nct
29 from neurocity.data import store
30 from neurocity.data import tools as data_tools

C:\Program Files\Anaconda3\Lib\site-packages\hart\neurocity_init_.py in ()
20 ########################################################################################
21
---> 22 from component.model.base import train_mode, test_mode, mode
23 from component import loss, layer
24 from component.model.model import Model

C:\Program Files\Anaconda3\Lib\site-packages\hart\neurocity\component_init_.py in ()
23
24 import tensorflow as tf
---> 25 from layer import Layer
26 from model.model import Model
27

C:\Program Files\Anaconda3\Lib\site-packages\hart\neurocity\component\layer.py in ()
26 import numpy as np
27
---> 28 from neurocity.component.model import base
29
30

C:\Program Files\Anaconda3\Lib\site-packages\hart\neurocity\component_init_.py in ()
23
24 import tensorflow as tf
---> 25 from layer import Layer
26 from model.model import Model
27

ImportError: cannot import name 'Layer'

saliency

I wonder whether you use the saliency in this paper,and it means what is the difference between the saliency and the attentive? I want to apply the saliency to the tracking

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.