Code Monkey home page Code Monkey logo

objrecposeest's Introduction

This is the code used to compute the results for the CVPR paper

@inproceedings{wohlhart15,
  author = "Paul Wohlhart and Vincent Lepetit",
  title = {{Learning Descriptors for Object Recognition and 3D Pose Estimation}},
  booktitle = {{Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}},
  year = 2015
}

or more precisely a refactored but functionally equivalent version thereof.

Thus far, there is no documentation, except for the sporadic, cryptic comments in the code. As soon as people start using this code and get back to me with questions, I will try to assemble a combination of tutorial and FAQ at the project website: https://www.tugraz.at/institute/icg/research/team-lepetit/research-projects/object-detection-and-3d-pose-estimation/

Additionally, I would like to make you aware of the efforts by Yida Wang to implement the above mentioned paper using a combination of opencv and caffe and contributing to both. At this point there is an initial pull request for the triplet loss layer: BVLC/caffe#2603

Disclaimer

This code is released under LPGLv3.0 (see lgpl-3.0.txt)

Additionally, note that running this code might cause unpleasent and unexpected output ranging from killing your kitten to the most unprobable events like turning a nuclear missile into a sperm whale or petunia.

Also, keep in mind this is my first project in python. If you find chunks making you feel "that's not how you do that in python", please go ahead and tell me about it.

Basic Requirements / Installation

  1. You need theano up and running (http://deeplearning.net/software/theano/)

  2. The project consists of two parts: TheanoNetCore and ObjRecPoseEst

    • ObjRecPoseEst is the application containing the logic to load and preprocess data, define a network, train and test it, visualize filters and sample results and output performance curves.
      It builds on TheanoNetCore which needs to be in the PYTHON_PATH to run any of the main routines of ObjRecPoseEst.
    • TheanoNetCore is our attempt to build a CNN specification/training/running framework on top of theano. (Had things like lasagne been around when we started, we would probably just have used that, but now we are stuck with our own stuff, and honestly I dont think its so bad.)
      TheanoNetCore was "designed" (ie. hacked away) with the idea to be very flexible. We dont impose any data-format other than the basic input to a theano function, which is essentially a numpy ndarray. Networks can be specified in config files, but dont have to be. There is functionality to specify, train, save, load and test networks. There are definitions for a number of different kinds of layers. With the recent additional of DAGNetworks (directed acyclic graph) the networks can even be quite complex in structure.
      There is a trainer taking care of training the network. Currently it's doing too much. Optimizers and Cost functions are not yet pulled into separate modular and interchangable entities. (That's a TODO).
      Additionally, there is a MacroBatchManager taking care of swapping in and out sets of minibatches (macro batches) if the whole training set (in addition to the network itself) is too large to fit into GPU all at once.
  3. You need my version of the LineMOD data
    Download the data from our project page https://www.tugraz.at/institute/icg/research/team-lepetit/research-projects/object-detection-and-3d-pose-estimation/
    Additionally you need the color images (colorXXX.jpg) of the test sequences from the original LineMOD dataset: http://campar.in.tum.de/Main/StefanHinterstoisser (median filtered versions of the corresponding depth data are included in the tars as pngs)

Main Workflow - to get the results of the paper

> cd ObjRecPoseEst 
> mkdir data/results/linemod_realandsynth_o15_dagnet
> cd src 

Adjust the path to the LineMOD data (lmDataBase) in linemod_ras_o15_rgbd_dagnet_simple.ini

> python main_train_dagnet.py ../configs/linemod_ras_o15_rgbd_dagnet_simple.ini 
> python main_test.py ../data/results/linemod_realandsynth_o15_dagnet/

For a simple demo on only 3 objects, 3-dim descriptors and only a few epochs of training (and thus to check if everything works) try the config file linemod_ras_o3_rgbd_dagnet.ini

TODO

Things I wanted to get done before releasing the code, but apparently wont get around to

Overall

  • Use logging instead of just printing everywhere

main_train_dagnet.py

  • Use loading and saving of networks, instead of pickling them a as a whole (which makes problems, for instance, when you move them between computers where you dont have the exact same theano version)

TheanoNetCore

  • Introduce Cost layers instead of computing the cost in the trainer
  • Move the optimization scheme from the trainer to reusable and exchangeable Optimizers

objrecposeest's People

Contributors

paroj avatar debaraj-barua avatar

Stargazers

 avatar Van Nguyen Nguyen avatar  avatar Henry avatar  avatar  avatar PengJunhuan avatar Xia_Hua avatar  avatar  avatar  avatar Sen Wang avatar Xiaocan Li avatar  avatar  avatar Tian Pi avatar bygreencn avatar  avatar PDC avatar This code is... avatar  avatar DanDoge avatar IronMan avatar Jack avatar Tianye Li avatar  avatar  avatar Julian Zhu avatar  avatar Ongun Kanat avatar Sean avatar Steve avatar Aileen Xi avatar  avatar Sinchiguano Cesar avatar Yang Yang avatar sinnis avatar Yingzheng Wu avatar Ameya Wagh avatar  avatar KL avatar  avatar zachary avatar Saurabh Khanduja avatar  avatar Wen Jiang avatar bin.sun avatar BoJiang avatar Harutaka Kawamura avatar  avatar  avatar Pablo Schaffner avatar LS Zhong avatar zoz avatar  avatar  avatar  avatar  avatar Richey Huang avatar  avatar  avatar YiChenCityU avatar Richard Williams avatar Adam Goh avatar  avatar  avatar  avatar  avatar Wonhui Kim avatar hhuang avatar  avatar

Watchers

James Cloos avatar  avatar YeoHong Yoon avatar  avatar  avatar  avatar  avatar  avatar  avatar

objrecposeest's Issues

TypeError: 'numpy.float64' object cannot be interpreted as an index

This error is ocurring when I run main_train_dagnet for the first time. Do you have any clue of how to solve it?

Traceback (most recent call last):
File "main_train_dagnet.py", line 1520, in
linemod_train_realandsynth_main(cfgparser)
File "main_train_dagnet.py", line 1378, in linemod_train_realandsynth_main
visNetworkFiltersMontage(descrNet,resPath+startTimePidStr+"_filters_init.png")
File "E:\ObjRecPoseEst-master\src\util\vis.py", line 264, in visNetworkFiltersMontage
visFilterMontageOfLayer(wvals,fileName=layerFN,windowName=windowName)
File "E:\ObjRecPoseEst-master\src\util\vis.py", line 217, in visFilterMontageOfLayer
wAll = numpy.zeros((numRowsrowHeight,numColscolWidth),dtype=numpy.float32)
TypeError: 'numpy.float64' object cannot be interpreted as an index

TypeError: TensorType does not support iteration

I'm` facing the error below while using the latest Theano version. Do you know how can I fix this?

Traceback (most recent call last):
File "main_train_dagnet.py", line 1515, in
linemod_train_realandsynth_main(cfgparser)
File "main_train_dagnet.py", line 1364, in linemod_train_realandsynth_main
descrNetTrainer = createTrainer(rng,cfg,descrNet,train_set,val_set,dataManager,resPath)
File "main_train_dagnet.py", line 1262, in createTrainer
descrNetTrainer.setDataAndCompileFunctions(train_set,val_set,dataManager,compileDebugFcts=True)
File "E:\ObjRecPoseEst-master\src\tnetcore\trainer.py", line 391, in setDataAndCompileFunctions
self.compileFunctions(compileDebugFcts)
File "E:\ObjRecPoseEst-master\src\tnetcore\trainer.py", line 427, in compileFunctions
self.setupTrain()
File "E:\ObjRecPoseEst-master\src\tnetcore\trainer.py", line 498, in setupTrain
givens_train = { tv: data[self.tvIndex * batch_size:(self.tvIndex + 1) * batch_size] for (tv,data) in zip(self.tvX,dm.tvsData_x) }
File "C:\Miniconda2\lib\site-packages\theano\tensor\var.py", line 632, in iter
raise TypeError(('TensorType does not support iteration. '
TypeError: TensorType does not support iteration. Maybe you are using builtin.sum instead of theano.tensor.sum? (Maybe .max?)

Error in addNoiseToTrainSeqs

I'm getting this error:

OpenCV Error: Unsupported format or combination of formats () in cv::medianBlur, file C:\build\2_4_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\smooth.cpp, line 1695
Traceback (most recent call last):
File "main_train_dagnet.py", line 1515, in
linemod_train_realandsynth_main(cfgparser)
File "main_train_dagnet.py", line 1315, in linemod_train_realandsynth_main
train_set, val_set, macroBatchSize = prepareData(cfg,rng)
File "main_train_dagnet.py", line 1131, in prepareData
addNoiseToTrainSeqs(trSeqs,inputMode,rng,addSoftNoise=True,softNoiseRange=0.01,addHardNoise=False,addBgNoise=True)
File "E:\ObjRecPoseEst-master\src\util\misc.py", line 135, in addNoiseToTrainSeqs
fractNoise = cv2.medianBlur(fractNoise,3)
cv2.error: C:\build\2_4_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\smooth.cpp:1695: error: (-210) in function cv::medianBlur

Do you have any idea what this might be?

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.