|
4 | 4 | Python 2.7, TensorFlow (>= 1.0), numpy, opencv 3.
|
5 | 5 |
|
6 | 6 | ## Getting started
|
| 7 | +### Compilation |
| 8 | +Please run the following commands to compile the library for the [crfasrnn module](https://github.com/sadeepj/crfasrnn_keras). |
| 9 | +```bash |
| 10 | +cd cpp |
| 11 | +sh compile.sh |
| 12 | +cd .. |
| 13 | +``` |
| 14 | + |
| 15 | +To train the network, you also need to run the following commands to compile the library for computing the set matching loss. (See [here](https://github.com/fanhqme/PointSetGeneration) for details.) |
| 16 | +```bash |
| 17 | +cd nndistance |
| 18 | +make |
| 19 | +cd .. |
| 20 | +``` |
| 21 | + |
| 22 | +### Data preparation |
| 23 | +We convert [ScanNet](http://www.scan-net.org/) data to *.tfrecords* files for training and testing. The *.tfrecords* file can be downloaded from [here](https://mega.nz/#!IvAixABb!PD3wJtXX_6W3qtfKZQtl_P07mYPLwWst3cwbvuTXlSY). |
| 24 | + |
| 25 | +### Training |
7 | 26 | To train the network from the pretrained DeepLab network, please first download the DeepLab model [here](https://github.com/DrSleep/tensorflow-deeplab-resnet) (under the Caffe to TensorFlow conversion), and then run the following command.
|
| 27 | +```bash |
| 28 | +python train_planenet.py --restore=0 --modelPathDeepLab="path to the deep lab model" --dataFolder="folder which contains tfrecords files" |
| 29 | +``` |
| 30 | + |
| 31 | +### Evaluation |
| 32 | +Please first download our trained network from [here](https://mega.nz/#!sjpT2DiQ!Uo-6hxyldmtnPoKk3TTdUHKZADRGy6nIPlmAeVzJs_8) and put the uncompressed folder under ./checkpoint folder. |
| 33 | + |
| 34 | +To evaluate the performance against existing methods, please run: |
| 35 | +```bash |
| 36 | +python evaluate.py --dataFolder="folder which contains tfrecords files" |
| 37 | +``` |
| 38 | + |
| 39 | +### Applications |
| 40 | +Please first download our trained network (see [Evaluation](### Evaluation) section for details). Script *predict.py* predicts and visualizes custom images (if "customImageFolder" is specified) or ScanNet testing images (if "dataFolder" is specified). |
8 | 41 |
|
9 | 42 | ```bash
|
10 |
| -python train_planenet.py --restore=0 |
| 43 | +python predict.py --customImageFolder="folder which contains custom images" |
| 44 | +python predict.py --dataFolder="folder which contains tfrecords files" [--startIndex=0] [--numImages=30] |
11 | 45 | ```
|
| 46 | + |
| 47 | +This will generate visualization images, a webpage containing all the visualization, as well as cache files under folder "predict/". |
| 48 | + |
| 49 | +Same commands can be used for various applications by providing optional arguments, *applicationType*, *imageIndex*, *textureImageFilename*, and some application-specific arguments. The following commands are used to generate visualizations in the submission. (The TV application needs more manual specification for better visualization.) |
| 50 | + |
| 51 | +```bash |
| 52 | +python predict.py --dataFolder=/mnt/vision/Data/PlaneNet/ --textureImageFilename=texture_images/CVPR.jpg --imageIndex=118 --applicationType=logo_texture --startIndex=118 --numImages=1 |
| 53 | +python predict.py --dataFolder=/mnt/vision/Data/PlaneNet/ --textureImageFilename=texture_images/CVPR.jpg --imageIndex=118 --applicationType=logo_video --startIndex=118 --numImages=1 |
| 54 | +python predict.py --dataFolder=/mnt/vision/Data/PlaneNet/ --textureImageFilename=texture_images/checkerboard.jpg --imageIndex=72 --applicationType=wall_texture --wallIndices=7,9 --startIndex=72 --numImages=1 |
| 55 | +python predict.py --dataFolder=/mnt/vision/Data/PlaneNet/ --textureImageFilename=texture_images/checkerboard.jpg --imageIndex=72 --applicationType=wall_video --wallIndices=7,9 --startIndex=72 --numImages=1 |
| 56 | +python predict.py --customImageFolder=my_images/TV/ --textureImageFilename=texture_images/TV.mp4 --imageIndex=0 --applicationType=TV --wallIndices=2,9 |
| 57 | +python predict.py --customImageFolder=my_images/ruler --textureImageFilename=texture_images/ruler_36.png --imageIndex=0 --applicationType=ruler --startPixel=950,444 --endPixel=1120,2220 |
| 58 | +``` |
| 59 | + |
| 60 | +Note that, the above script generate image sequences for video applications. Please run the following command under the image sequence folder to generate a video: |
| 61 | +```bash |
| 62 | +ffmpeg -r 60 -f image2 -s 640x480 -i %04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p video.mp4 |
| 63 | +``` |
| 64 | + |
| 65 | +To check out the pool ball application, please run the following commands. |
| 66 | +```bash |
| 67 | +python predict.py --customImageFolder=my_images/pool --imageIndex=0 --applicationType=pool --estimateFocalLength=False |
| 68 | +cd pool |
| 69 | +python pool.py |
| 70 | +``` |
| 71 | + |
| 72 | +Use mouse to play:) |
0 commit comments