Giter Site home page Giter Site logo

marvinteichmann / kittiseg Goto Github PK

View Code? Open in Web Editor NEW
905.0 43.0 405.0 11.84 MB

A Kitti Road Segmentation model implemented in tensorflow.

License: MIT License

Python 100.00%
segmentation tensorflow kitti-data autonomous-driving computer-vision fcn semantic

kittiseg's Introduction

KittiSeg

KittiSeg performs segmentation of roads by utilizing an FCN based model. The model achieved first place on the Kitti Road Detection Benchmark at submission time. Check out our paper for a detailed model description.

The model is designed to perform well on small datasets. The training is done using just 250 densely labelled images. Despite this a state-of-the art MaxF1 score of over 96% is achieved. The model is usable for real-time application. Inference can be performed at the impressive speed of 95ms per image.

The repository contains code for training, evaluating and visualizing semantic segmentation in TensorFlow. It is build to be compatible with the TensorVision back end which allows to organize experiments in a very clean way. Also check out KittiBox a similar projects to perform state-of-the art detection. And finally the MultiNet repository contains code to jointly train segmentation, classification and detection. KittiSeg and KittiBox are utilized as submodules in MultiNet.

Requirements

The code requires Tensorflow 1.0, python 2.7 as well as the following python libraries:

  • matplotlib
  • numpy
  • Pillow
  • scipy
  • commentjson

Those modules can be installed using: pip install numpy scipy pillow matplotlib commentjson or pip install -r requirements.txt.

Setup

  1. Clone this repository: git clone https://github.com/MarvinTeichmann/KittiSeg.git
  2. Initialize all submodules: git submodule update --init --recursive
  3. [Optional] Download Kitti Road Data:
    1. Retrieve kitti data url here: http://www.cvlibs.net/download.php?file=data_road.zip
    2. Call python download_data.py --kitti_url URL_YOU_RETRIEVED

Running the model using demo.py does not require you to download kitti data (step 3). Step 3 is only required if you want to train your own model using train.py or bench a model agains the official evaluation score evaluate.py. Also note, that I recommend using download_data.py instead of downloading the data yourself. The script will also extract and prepare the data. See Section Manage data storage if you like to control where the data is stored.

To update an existing installation do:
  1. Pull all patches: git pull
  2. Update all submodules: git submodule update --init --recursive

If you forget the second step you might end up with an inconstant repository state. You will already have the new code for KittiSeg but run it old submodule versions code. This can work, but I do not run any tests to verify this.

Tutorial

Getting started

Run: python demo.py --input_image data/demo/demo.png to obtain a prediction using demo.png as input.

Run: python evaluate.py to evaluate a trained model.

Run: python train.py --hypes hypes/KittiSeg.json to train a model using Kitti Data.

If you like to understand the code, I would recommend looking at demo.py first. I have documented each step as thoroughly as possible in this file.

Manage Data Storage

KittiSeg allows to separate data storage from code. This is very useful in many server environments. By default, the data is stored in the folder KittiSeg/DATA and the output of runs in KittiSeg/RUNS. This behaviour can be changed by setting the bash environment variables: $TV_DIR_DATA and $TV_DIR_RUNS.

Include export TV_DIR_DATA="/MY/LARGE/HDD/DATA" in your .profile and the all data will be downloaded to /MY/LARGE/HDD/DATA/data_road. Include export TV_DIR_RUNS="/MY/LARGE/HDD/RUNS" in your .profile and all runs will be saved to /MY/LARGE/HDD/RUNS/KittiSeg

RUNDIR and Experiment Organization

KittiSeg helps you to organize large number of experiments. To do so the output of each run is stored in its own rundir. Each rundir contains:

  • output.log a copy of the training output which was printed to your screen
  • tensorflow events tensorboard can be run in rundir
  • tensorflow checkpoints the trained model can be loaded from rundir
  • [dir] images a folder containing example output images. image_iter controls how often the whole validation set is dumped
  • [dir] model_files A copy of all source code need to build the model. This can be very useful of you have many versions of the model.

To keep track of all the experiments, you can give each rundir a unique name with the --name flag. The --project flag will store the run in a separate subfolder allowing to run different series of experiments. As an example, python train.py --project batch_size_bench --name size_5 will use the following dir as rundir: $TV_DIR_RUNS/KittiSeg/batch_size_bench/size_5_KittiSeg_2017_02_08_13.12.

The flag --nosave is very useful to not spam your rundir.

Modifying Model & Train on your own data

The model is controlled by the file hypes/KittiSeg.json. Modifying this file should be enough to train the model on your own data and adjust the architecture according to your needs. A description of the expected input format can be found here.

For advanced modifications, the code is controlled by 5 different modules, which are specified in hypes/KittiSeg.json.

"model": {
   "input_file": "../inputs/kitti_seg_input.py",
   "architecture_file" : "../encoder/fcn8_vgg.py",
   "objective_file" : "../decoder/kitti_multiloss.py",
   "optimizer_file" : "../optimizer/generic_optimizer.py",
   "evaluator_file" : "../evals/kitti_eval.py"
},

Those modules operate independently. This allows easy experiments with different datasets (input_file), encoder networks (architecture_file), etc. Also see TensorVision for a specification of each of those files.

Utilize TensorVision backend

KittiSeg is build on top of the TensorVision TensorVision backend. TensorVision modularizes computer vision training and helps organizing experiments.

To utilize the entire TensorVision functionality install it using

$ cd KittiSeg/submodules/TensorVision
$ python setup.py install

Now you can use the TensorVision command line tools, which includes:

tv-train --hypes hypes/KittiSeg.json trains a json model.
tv-continue --logdir PATH/TO/RUNDIR trains the model in RUNDIR, starting from the last saved checkpoint. Can be used for fine tuning by increasing max_steps in model_files/hypes.json .
tv-analyze --logdir PATH/TO/RUNDIR evaluates the model in RUNDIR

Useful Flags & Variabels

Here are some Flags which will be useful when working with KittiSeg and TensorVision. All flags are available across all scripts.

--hypes : specify which hype-file to use
--logdir : specify which logdir to use
--gpus : specify on which GPUs to run the code
--name : assign a name to the run
--project : assign a project to the run
--nosave : debug run, logdir will be set to debug

In addition the following TensorVision environment Variables will be useful:

$TV_DIR_DATA: specify meta directory for data
$TV_DIR_RUNS: specify meta directory for output
$TV_USE_GPUS: specify default GPU behaviour.

On a cluster it is useful to set $TV_USE_GPUS=force. This will make the flag --gpus mandatory and ensure, that run will be executed on the right GPU.

Questions?

Please have a look into the FAQ. Also feel free to open an issue to discuss any questions not covered so far.

Citation

If you benefit from this code, please cite our paper:

@article{teichmann2016multinet,
  title={MultiNet: Real-time Joint Semantic Reasoning for Autonomous Driving},
  author={Teichmann, Marvin and Weber, Michael and Zoellner, Marius and Cipolla, Roberto and Urtasun, Raquel},
  journal={arXiv preprint arXiv:1612.07695},
  year={2016}
}

kittiseg's People

Contributors

hlnull avatar marvinteichmann avatar villanuevab avatar zilongzhong 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kittiseg's Issues

About multiclass (non-binary) segmentation

Thanks so much for making your code available. Anyway, I would like to modify your code so that, assuming there can only be N possible classes, the code would be able to detect and identify the K<=N classes that are in the scene and segment them (by different colors) accordingly.

I read through your doc on how to train your own data, and I'm afraid I need more guidance.

Can you please clarify the steps needed to achieve this? Thanks so much in advance.

IndexError: index 256 is out of bounds for axis 0 with size 256

As the training program ran out of my 2G GPU memory, I reduced the number of pictures in the data_road and cut it into 256 ร— 256 size, but when run 'python evaluate.py', the following error occurred:
2017-04-18 16:27:51,679 INFO Output Images will be written to: RUNS/KittiSeg_pretrained/analyse/images/
W tensorflow/core/common_runtime/bfc_allocator.cc:217] Ran out of memory trying to allocate 1.08GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory is available.
W tensorflow/core/common_runtime/bfc_allocator.cc:217] Ran out of memory trying to allocate 2.14GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory is available.
W tensorflow/core/common_runtime/bfc_allocator.cc:217] Ran out of memory trying to allocate 1.08GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory is available.
incl/seg_utils/seg_utils.py:74: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 256 but corresponding boolean dimension is 375
fnArray = cur_prob[(gtBin == True) & (validMap == True)]
Traceback (most recent call last):
File "evaluate.py", line 122, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "evaluate.py", line 110, in main
ana.do_analyze(logdir)
File "incl/tensorvision/analyze.py", line 95, in do_analyze
hypes, sess, image_pl, inf_out)
File "RUNS/KittiSeg_pretrained/model_files/eval.py", line 119, in evaluate
FN, FP, posNum, negNum = eval_image(hypes, gt_image, output_im)
File "RUNS/KittiSeg_pretrained/model_files/eval.py", line 30, in eval_image
validArea=valid_gt)
File "incl/seg_utils/seg_utils.py", line 74, in evalExp
fnArray = cur_prob[(gtBin == True) & (validMap == True)]
IndexError: index 256 is out of bounds for axis 0 with size 256
I don't know how to solve this problem๏ผŒcan you help me? Thank you!

Import module 'seg_utils' Error

I followed the instructions, and downloaded vgg16.npy and data_road.zip successfully, but when I run the command: python demo.py --input_image data/demo/demo.png --output_image data/demo/demo_seg.png
I got the error message as following:
Traceback (most recent call last):
File "demo.py", line 51, in
from seg_utils import seg_utils as seg
ImportError: No module named 'seg_utils'
I use Anaconda3 (64-bit)/Windows 7

binary object detection like people

Hello,

at first, thank you for the code! I want to be able to detect an object in the image, for example in urban scenes people or something else. I prepared images (raw and ground truth) for training (~200) and validation (~50) step. The resolution is 330 x 240 px. I followed the instructions in inputs.md and also created a hypes file, in which I changed only the path to the data.

  1. After the preprocessing steps, can I start immediately the training step? Of course the training starts, but I am not sure, if this is the right way. :(

  2. Do I train the fcn from stretch or from an pretrained fcn?

Greetings!

[Q] The skipping canceled enqueue while training.

I attempt training using KITTI dataset.
After 5 hours, It is canceled.
Could you tell me the solution for this problem?

2017-06-05 21:12:34,341 INFO Step 11920/12000: loss = 0.22; lr = 1.00e-05; 0.215 sec (per Batch); 4.7 imgs/sec
2017-06-05 21:12:34,512 INFO (raw) Acc. : 0.99, xentropy: 0.02, weight_loss: 0.20
2017-06-05 21:12:34,512 INFO (smooth) Acc. : 0.99, xentropy: 0.01, weight_loss: 0.21
2017-06-05 21:12:45,605 INFO Step 11940/12000: loss = 0.22; lr = 1.00e-05; 0.222 sec (per Batch); 4.5 imgs/sec
2017-06-05 21:12:45,773 INFO (raw) Acc. : 1.00, xentropy: 0.01, weight_loss: 0.20
2017-06-05 21:12:45,773 INFO (smooth) Acc. : 0.99, xentropy: 0.01, weight_loss: 0.21
2017-06-05 21:12:56,879 INFO Step 11960/12000: loss = 0.23; lr = 1.00e-05; 0.222 sec (per Batch); 4.5 imgs/sec
2017-06-05 21:12:57,050 INFO (raw) Acc. : 0.99, xentropy: 0.02, weight_loss: 0.20
2017-06-05 21:12:57,050 INFO (smooth) Acc. : 0.99, xentropy: 0.01, weight_loss: 0.21
2017-06-05 21:13:08,226 INFO Step 11980/12000: loss = 0.22; lr = 1.00e-05; 0.224 sec (per Batch); 4.5 imgs/sec
2017-06-05 21:13:08,396 INFO (raw) Acc. : 0.99, xentropy: 0.01, weight_loss: 0.20
2017-06-05 21:13:08,397 INFO (smooth) Acc. : 0.99, xentropy: 0.01, weight_loss: 0.21
2017-06-05 21:13:18,961 INFO Running Evaluation Script.
2017-06-05 21:14:22.844011: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:01:00.0)
2017-06-05 21:14:22,984 INFO Evaluation Finished. All results will be saved to:
2017-06-05 21:14:22,984 INFO /home/chamcham/Dev/KittiSeg/hypes/../RUNS/KittiSeg_2017_06_05_16.43
2017-06-05 21:14:23,107 INFO Raw Results:
2017-06-05 21:14:23,107 INFO [train] MaxF1 (raw) : 98.1701
2017-06-05 21:14:23,107 INFO [train] BestThresh (raw) : 48.2353
2017-06-05 21:14:23,107 INFO [train] Average Precision (raw) : 92.5361
2017-06-05 21:14:23,107 INFO [val] MaxF1 (raw) : 96.1826
2017-06-05 21:14:23,107 INFO [val] BestThresh (raw) : 29.8039
2017-06-05 21:14:23,107 INFO [val] Average Precision (raw) : 92.3907
2017-06-05 21:14:23,107 INFO Speed (msec) (raw) : 152.7702
2017-06-05 21:14:23,108 INFO Speed (fps) (raw) : 6.5458
2017-06-05 21:14:23,108 INFO Smooth Results:
2017-06-05 21:14:23,108 INFO [train] MaxF1 (smooth) : 98.0138
2017-06-05 21:14:23,108 INFO [train] BestThresh (smooth) : 46.4706
2017-06-05 21:14:23,108 INFO [train] Average Precision (smooth) : 92.5366
2017-06-05 21:14:23,108 INFO [val] MaxF1 (smooth) : 95.8499
2017-06-05 21:14:23,108 INFO [val] BestThresh (smooth) : 26.2745
2017-06-05 21:14:23,108 INFO [val] Average Precision (smooth) : 92.3395
2017-06-05 21:14:23,108 INFO Speed (msec) (smooth) : 152.7629
2017-06-05 21:14:23,108 INFO Speed (fps) (smooth) : 6.5461
2017-06-05 21:14:38.006668: W tensorflow/core/kernels/queue_base.cc:294] _0_Queues/fifo_queue: Skipping cancelled enqueue attempt with queue not closed

git clone command error

Hi, @MarvinTeichmann ,

I try the command as listed in README.md,

$ git clone [email protected]:MarvinTeichmann/KittiSeg.git

I got the following error:

Cloning into 'KittiSeg'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any suggestion to fix this problem? THX~

Resource Exhausted: OOM when allocating tensor

I'm trying to train the KittSeg model using Kitti Data by running 'python train.py --hypes hypes/KittiSeg.json', but I got the following problem:

W tensorflow/core/common_runtime/bfc_allocator.cc:274] **************************************************************************************xxxxxxxxxxxxxx
W tensorflow/core/common_runtime/bfc_allocator.cc:275] Ran out of memory trying to allocate 32.0KiB.  See logs for memory state.
W tensorflow/core/framework/op_kernel.cc:993] Resource exhausted: OOM when allocating tensor with shape[1,1,4096,2]

Does anyone know how to solve this?

any suggestion on how to train in batch?

Thank you for open sourcing this project and your tensorvision backend. It helps a lot.

I can see that when you generate image and label, in training phase, you call jitter_input on both the input image and the label.

But if we want to train in batch, we have to ensure that all input images have the same shape. Here are my questions.

  1. I've seen your code that resizes both image and label, but I don't understand what should the label be when you make the input image larger or smaller. Any best practice on this?

  2. I can image that an approach I can take is to pad all the images to the same shapes, and assign the padded pixels void label. and ignore any predictions on the padding pixels later. what do you think of this approach?

  3. another question is that, if you do random crop and resize to input image and label, the model you trained is fed with only part of the image and label, how do you make it predict the whole image on test set?

thx๏ผ

IndexError: index 320 is out of bounds for axis 0 with size 320

Hello,

I've been trying to train your KittiSeg network on some cell data.
I've taken the following steps to convert the network for my data:

  • changed the hypes image size
  • changed hypes background/foreground color
  • replaced the maybe_download_and_extract function

The network trains as it is supposed to, but when it runs the evaluation script, I get the following error:

/gpfs/gss1/home/frhaa13/DeepBacteriaSegmentation/network/incl/seg_utils/seg_utils.py:74: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 320 but correspondin$
  fnArray = cur_prob[(gtBin == True) & (validMap == True)]
/gpfs/gss1/home/frhaa13/DeepBacteriaSegmentation/network/incl/seg_utils/seg_utils.py:82: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 320 but correspondin$
  fpArray = cur_prob[(gtBin == False) & (validMap == True)]
W tensorflow/core/kernels/queue_base.cc:294] _0_Queues/fifo_queue: Skipping cancelled enqueue attempt with queue not closed
Traceback (most recent call last):
  File "train.py", line 133, in <module>
    tf.app.run()
  File "/gpfs/gss1/home/frhaa13/tensorenv/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train.py", line 129, in main
    train.do_training(hypes)
  File "incl/tensorvision/train.py", line 396, in do_training
    run_training(hypes, modules, tv_graph, tv_sess)
  File "incl/tensorvision/train.py", line 289, in run_training
    hypes, sess, tv_graph['image_pl'], tv_graph['inf_out'])
  File "/gpfs/gss1/home/frhaa13/DeepBacteriaSegmentation/network/hypes/../evals/kitti_eval.py", line 127, in evaluate
    gt_image, output_im)
  File "/gpfs/gss1/home/frhaa13/DeepBacteriaSegmentation/network/hypes/../evals/kitti_eval.py", line 34, in eval_image
    validArea=valid_gt)
  File "/gpfs/gss1/home/frhaa13/DeepBacteriaSegmentation/network/incl/seg_utils/seg_utils.py", line 82, in evalExp
    fpArray = cur_prob[(gtBin == False) & (validMap == True)]
IndexError: index 320 is out of bounds for axis 0 with size 320

Can anyone train on your own data well?

I want to train this model on my own data, which is collected from the camera in our car. After I label these pictures with "road_color" and โ€œbackground_color",and then I try to use train.py. However, in ./RUN/**/image , the test image always perform badly. I want to ask , has anyone successfully trained his own model on his own data?
In some images in ./DATA/data_road/training/gt_image_2, I found some black blocks in these images. I know [255,0,255] means road_color, and [255,0,0] means background_color. What does these black blocks means?
Thanks for help~

_load_gt_file too many values to unpack

I feel like a chump, but I have produced groundtruth images along with their natural counterparts and produced a train.txt and val.txt that appear to be the same format as the kittiseg versions. When I run train.py I get the following error:

File "train.py", line 131, in
tf.app.run()
File "/Users/wnas0001/anaconda3/envs/python2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train.py", line 127, in main
train.do_training(hypes)
File "incl/tensorvision/train.py", line 393, in do_training
modules['input'].start_enqueuing_threads(hypes, queue, 'train', sess)
File "/../inputs/kitti_seg_input.py", line 355, in start_enqueuing_threads
gen.next()
File "/../inputs/kitti_seg_input.py", line 155, in _make_data_gen
for image, gt_image in data:
File "/../inputs/kitti_seg_input.py", line 114, in _load_gt_file
image_file, gt_image_file = file.split(" ")
ValueError: too many values to unpack

I believe it has something to do with my txt file, which I've attached. Any help is greatly appreciated!
train.txt

reload previous model in a new training

Hello,

I have a model trained with 500 images (Kitti data and ~200 images of my own). Now I want to add new images to improve this model.
My question is, instead of re-train with all 520 images, can I reload this model and add 20 new images to re-train and improve this model? Maybe something like saver = tf.train.import_meta_graph('my_test_model-1000.meta') in tensorflow. How can I achieve it with minimal modification on train.py or tensorvision code?

Thank you very much!

bug in download_data.py

the default data_dir = "DATA",that is what I use. the vgg data is in 'DATA/vgg16.npy'. But when decide whether to download the vgg data or not,you use vgg_weights = os.path.join(data_dir, 'weights', 'vgg16.npy'), which the folder is 'DATA/weights/vgg16.npy', this will cause redownload the vgg data again and agin(default: the data is stored in 'DATA/vgg16.npy')

Multiple classes e.g., lane markings?

Hello! Thanks for sharing this awesome work. May I ask if the model is extensible to segment multiple classes? I see here that KittiBox is not easily extensible to the case of multiple custom classes. Does the same go for the this module, too? I.e., is it the case that the segmentation submodule has classes road/not road; the bbox submodule has object/not object and it is difficult to extend these submodules to multiple classes?

Segmentation of new data using pretrained network

I have been using your framework to train networks for bacteria segmentation with great succes.
However, now I would like to actually use the networks to segment new data, and I can't for the life of me figure out how.

I have installed the TensorVision backend, so I have access to tv-analyze etc.

When i run tv-analyze --logdir ~/KittiSeg/RUNS/run1/ i get the following error:

2017-04-19 09:48:42,689 INFO No environment variable 'TV_PLUGIN_DIR' found. Set to '/home/frederik/tv-plugins'.
2017-04-19 09:48:42,689 INFO No environment variable 'TV_STEP_SHOW' found. Set to '50'.
2017-04-19 09:48:42,689 INFO No environment variable 'TV_STEP_EVAL' found. Set to '250'.
2017-04-19 09:48:42,690 INFO No environment variable 'TV_STEP_WRITE' found. Set to '1000'.
2017-04-19 09:48:42,690 INFO No environment variable 'TV_MAX_KEEP' found. Set to '10'.
2017-04-19 09:48:42,690 INFO No environment variable 'TV_STEP_STR' found. Set to 'Step {step}/{total_steps}: loss = {loss_value:.2f}; lr = {lr_value:.2e}; {sec_per_batch:.3f} sec (per Batch); {examples_per_sec:.1f} imgs/sec'.
2017-04-19 09:48:42,690 INFO Starting to analyze model in '/home/frederik/Documents/Uni/semester_8/AI4/DeepBacteriaSegmentation/network/RUNS/KittiSeg-5000_2017_04_18_18.27'
2017-04-19 09:48:42,690 INFO f: <open file '/home/frederik/Documents/Uni/semester_8/AI4/DeepBacteriaSegmentation/network/RUNS/KittiSeg-5000_2017_04_18_18.27/model_files/hypes.json', mode 'r' at 0x7f6505edc810>
Traceback (most recent call last):
  File "./tv-analyze", line 4, in <module>
    __import__('pkg_resources').run_script('tensorvision==0.1.dev1', 'tv-analyze')
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 738, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1499, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/tensorvision-0.1.dev1-py2.7.egg/EGG-INFO/scripts/tv-analyze", line 36, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/usr/local/lib/python2.7/dist-packages/tensorvision-0.1.dev1-py2.7.egg/tensorvision/analyze.py", line 476, in main
    do_analyze(FLAGS.logdir)
  File "/usr/local/lib/python2.7/dist-packages/tensorvision-0.1.dev1-py2.7.egg/tensorvision/analyze.py", line 62, in do_analyze
    modules = utils.load_modules_from_logdir(logdir)
  File "/usr/local/lib/python2.7/dist-packages/tensorvision-0.1.dev1-py2.7.egg/tensorvision/utils.py", line 215, in load_modules_from_logdir
    arch = imp.load_source("arch_%s" % postfix, f)
  File "/home/frederik/Documents/Uni/semester_8/AI4/DeepBacteriaSegmentation/network/RUNS/KittiSeg-5000_2017_04_18_18.27/model_files/architecture.py", line 15, in <module>
    from tensorflow_fcn import fcn8_vgg
ImportError: No module named tensorflow_fcn

Any idea how I get it to locate tensorflow_fcn?

Also, can I even use tv-analyze to segment new data, or is it only for evaluating the performance of a trained network?

Error when import module 'seg_utils'

When I run demo.py use :
python demo.py --input_image data/demo/demo.png

There is an ImportError :
cannot import name 'seg_utils'

How can I solve it?

kitti_multiloss.py generates ValueError: inputs must be a list of at least one Tensor with the same dtype and shape

Hi Marvin,

I have gotten the the demo.py running successfully, and now I am trying to experimenting with train.py. However, I got the following error message

File "/home/ decoder/kitti_multiloss.py", line 86, in loss
name='reg_loss')
File "/devl /tensorflow/tf/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py", line 1827, in add_n
raise ValueError("inputs must be a list of at least one Tensor with the "
ValueError: inputs must be a list of at least one Tensor with the same dtype and shape

It is caused by reg_loss_col = tf.GraphKeys.REGULARIZATION_LOSSES weight_loss = tf.add_n(tf.get_collection(reg_loss_col),name='reg_loss') in kitti_multiloss.py Are there any ways to print out the information of tf.get_collection(reg_loss_col) to figure out why the error was generated.

plot MaxF1 and Average Precision like results in your paper

Dear Teichmann,

Most of all, Thank you for sharing your great work with us.

Now, I trained multi class segmentation with my own datasets and I found it works well.

To increase the segmentation result, I want to plot total maxF1 and average precision like figures 4 and 6 you added in your "MultiNet: Real-time Joint Semantic Reasoning for Autonomous Driving".

I saw all logs were saved in "output.log", but, it seems not to be a kind of good format for plotting.

Could you suggest efficient ways to plot the trainig result?

Secondly, which hyperparameters should be adjusted to improve the segmentation result?

Br,

Could not import the submodules

Hi,
I using the command line "git submodule update --init --recursive". Then run python demo.py --input_image data/demo/demo.png. It display the erros.

2017-05-08 10:15:15,383 ERROR Could not import the submodules.
2017-05-08 10:15:15,384 ERROR Please execute:'git submodule update --init --recursive'

Thanks and Best Regards,

using non Kitti data with model

Any tips on getting model to work with non kitti data?

I ran kittiseg against an image of a road using demo.py and pre-trained weights. it didn't detect anything. might it be sensitive to lighting conditions? aspect ratio (i cropped the image to have similar dimensions, but this did not help)?

works great with all of the images from kitti.

thanks!

issues with python train.py --hypes hypes/KittiSeg.json

When i tried running python train.py --hypes hypes/KittiSeg.json, i got below error.

2017-04-30 17:29:56,186 ERROR File '/home/gopi/tensorflow/KittiSeg/hypes/../DATA/weights/vgg16.npy' not found. Download it from ftp://mi.eng.cam.ac.uk/pub/mttt2/models/vgg16.npy

Actually I see the vgg16.npy got downloaded into DATA folder along with data_road.zip during demo operation, do i need to manually copy this file into some other folder? the generated path "/hypes/../DATA/" looks like path join issue, please check it.

FYI , I could be able to run the python demo.py successfully using pre trained data.

Is loading vgg16 model redundant in demo.py?

Marvin,

Just to make sure I understand how KittiSeg works correctly. When I run demo.py, the code load vgg16 model. But these parameters would eventually be overwritten by the fine tuned weights in the checkpoint. Is my understanding correct?

Thanks
Jia

When I run python demo.py --input_image data/demo.png,I got EOFError

Hi,Ithanks for your share of code first.When I run python demo.py --input_image data/demo.png,I got EOFError.

2017-03-27 20:57:48,990 INFO No environment variable 'TV_PLUGIN_DIR' found. Set to '/home/tian/tv-plugins'.
2017-03-27 20:57:48,990 INFO No environment variable 'TV_STEP_SHOW' found. Set to '50'.
2017-03-27 20:57:48,990 INFO No environment variable 'TV_STEP_EVAL' found. Set to '250'.
2017-03-27 20:57:48,990 INFO No environment variable 'TV_STEP_WRITE' found. Set to '1000'.
2017-03-27 20:57:48,990 INFO No environment variable 'TV_MAX_KEEP' found. Set to '10'.
2017-03-27 20:57:48,990 INFO No environment variable 'TV_STEP_STR' found. Set to 'Step {step}/{total_steps}: loss = {loss_value:.2f}; lr = {lr_value:.2e}; {sec_per_batch:.3f} sec (per Batch); {examples_per_sec:.1f} imgs/sec'.
2017-03-27 20:57:48,991 INFO f: <open file 'RUNS/KittiSeg_pretrained/model_files/hypes.json', mode 'r' at 0x7f96c3d785d0>
2017-03-27 20:57:48,991 INFO Hypes loaded successfully.
2017-03-27 20:57:48,992 INFO Modules loaded successfully. Starting to build tf graph.
Traceback (most recent call last):
File "demo.py", line 216, in
tf.app.run()
File "/home/tian/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "demo.py", line 147, in main
image=image)
File "incl/tensorvision/core.py", line 137, in build_inference_graph
logits = modules['arch'].inference(hypes, image, train=False)
File "RUNS/KittiSeg_pretrained/model_files/architecture.py", line 23, in inference
vgg_fcn = fcn8_vgg.FCN8VGG(vgg16_npy_path=vgg16_npy_path)
File "/home/tian/a/KittiSeg-master/incl/tensorflow_fcn/fcn8_vgg.py", line 33, in init
self.data_dict = np.load(vgg16_npy_path, encoding='latin1').item()
File "/home/tian/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 406, in load
pickle_kwargs=pickle_kwargs)
File "/home/tian/anaconda2/lib/python2.7/site-packages/numpy/lib/format.py", line 637, in read_array
array = pickle.load(fp, **pickle_kwargs)
EOFError

I don't know what should I do.Looking forward to your answer.Thank you very much.

regarding the TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.`

Hi Marvin,

When running the demo.py, I got the following error message. In specific, the related error is TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32. I googled the error, which seems to be caused by version problem. I am using tensorflow 0.12.0-rc0.

Thank you for the advice.

2017-03-22 21:46:48,881 INFO Modules loaded successfully. Starting to build tf graph.
npy file loaded
Traceback (most recent call last):
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py", line 490, in apply_op
preferred_dtype=default_dtype)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/framework/ops.py", line 669, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/framework/ops.py", line 583, in _TensorTensorConversionFunction
% (dtype.name, t.dtype.name, str(t)))
ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("ExpandDims:0", dtype=float32)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "demo.py", line 101, in
tf.app.run()
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "demo.py", line 87, in main
prediction = core.build_inference_graph(hypes, modules,image=image)
File "/home/ug/GPU-Study/keras/FCN/fcn/tensorvision/core.py", line 137, in build_inference_graph
logits = modules['arch'].inference(hypes, image, train=False)
File "/data/dsp_emerging/ug/FCN/KittiSeg_pretrained/model_files/architecture.py", line 28, in inference
vgg_fcn.build(images, train=train, num_classes=2, random_init_fc8=True)
File "/home/ug/GPU-Study/keras/FCN/fcn/tensorflow_fcn/fcn8_vgg.py", line 60, in build
red, green, blue = tf.split(rgb, 3, 3)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/ops/array_ops.py", line 1159, in split
name=name)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3241, in _split
num_split=num_split, name=name)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py", line 508, in apply_op
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.

Problems loading Resnet

I'm running into an issue where the model works great when using VGG, however fails to load the weights properly for Resnet.

I downloaded the Resnet 101 checkpoint file from here: https://github.com/tensorflow/models/tree/master/slim#pre-trained-models

Then placed it under KittiSeg/DATA/weights/tensorflow_resnet/ResNet-L101.ckpt

But when I run this:
python train.py --hypes hypes/KittiSeg_ResNet.json

I get the following error:
NotFoundError (see above for traceback): Tensor name "scale4/block11/b/moving_variance" not found in checkpoint files DATA/weights/tensorflow_resnet/ResNet-L101.ckpt

Any idea why this wouldn't be working, or tips on finding a different set of Resnet weights that would work with this project? Thanks so much.

No such file or directory: 'RUNS/KittiSeg_pretrained.zip'

Hi,

After downloading the data, installing the requirements.txt packages and tensorflow I attempted the demo and got this error.

python demo.py --input_image data/demo/demo.png
2017-03-10 07:50:36,788 INFO No environment variable 'TV_PLUGIN_DIR' found. Set to '/home/lap/tv-plugins'.
2017-03-10 07:50:36,788 INFO No environment variable 'TV_STEP_SHOW' found. Set to '50'.
2017-03-10 07:50:36,788 INFO No environment variable 'TV_STEP_EVAL' found. Set to '250'.
2017-03-10 07:50:36,788 INFO No environment variable 'TV_STEP_WRITE' found. Set to '1000'.
2017-03-10 07:50:36,788 INFO No environment variable 'TV_MAX_KEEP' found. Set to '10'.
2017-03-10 07:50:36,788 INFO No environment variable 'TV_STEP_STR' found. Set to 'Step {step}/{total_steps}: loss = {loss_value:.2f}; lr = {lr_value:.2e}; {sec_per_batch:.3f} sec (per Batch); {examples_per_sec:.1f} imgs/sec'.
2017-03-10 07:50:36,788 INFO Download URL: ftp://mi.eng.cam.ac.uk/pub/mttt2/models/KittiSeg_pretrained.zip
2017-03-10 07:50:36,789 INFO Download DIR: RUNS
Traceback (most recent call last):
File "demo.py", line 216, in
tf.app.run()
File "/media/lap/data/.virtualenvs/KittySeg/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "demo.py", line 124, in main
maybe_download_and_extract(runs_dir)
File "demo.py", line 87, in maybe_download_and_extract
download_name = tv_utils.download(weights_url, runs_dir)
File "incl/tensorvision/utils.py", line 48, in download
reporthook=_progress)
File "/usr/lib/python2.7/urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "/usr/lib/python2.7/urllib.py", line 249, in retrieve
tfp = open(filename, 'wb')
IOError: [Errno 2] No such file or directory: 'RUNS/KittiSeg_pretrained.zip'

Did I miss a step?

OOM problem.

Hello,
when I run the demo using

python demo.py --input_image data/demo/demo.png

the following error occurs:

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[7,7,512,4096]
[[Node: save/Assign_27 = Assign[T=DT_FLOAT, _class=["loc:@fc6/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/gpu:0"](fc6/weights, save/RestoreV2_27/_25)]]

It seems that my RAM is not large enough. I use my laptop, with 8G RAM and GeForce 940M (1G memory). What is the minimum size required?

Thanks.

How to speed up predictions

I'm wondering if you have any ideas on how to speed up predictions. So far it's taking roughly a second per prediction, making it tough to get through large numbers (thousands) of images.

Would appreciate any thoughts you have!

Better way to share KittiSeg_pretrained.zip

I have been constantly trying to download KittiSeg_pretrained.zip from ftp://129.169.82.147/pub/mttt2/models/KittiSeg_pretrained.zip. I have been trying every hour since the last couple of days.I already checked #19 #18 #33 . It is not the case that I forgot to unzip the file in the RUNS folder.

Can someone share their local copy via dropbox,google drive or any other method? My email id [email protected]

How to use resnet?

Hi, Marvin. Thank you for your KittiSeg and the tutorial. I want to changge the vgg16 to resnet ,and the model has been downloaded ,but when I run train.py ,I met this error:
NotFoundError (see above for traceback): Tensor name "scale1/scale1/moving_mean/local_step" not found in checkpoint files DATA/weights/tensorflow_resnet/ResNet-L50.ckpt
Should I change some code?@MarvinTeichmann

How to do fast evaluate

Hello, I have started DeepLearning recently.
I'm really new in this field.
first of all, I really appreciate to learn this code.

This KittiSeg is really good for image segmentation.
However, It takes little bit long time to evaluate images.

Is there any method to evaluate fast?

Out of Memory on 2GB GPU

Hello,

I attempted to run the training example and ran into an OOM condition. Please find below a detailed log.

Could you provide advice as to how the training data can be fed in smaller batches?

LOG:
...
`I tensorflow/core/common_runtime/bfc_allocator.cc:696] 20 Chunks of size 256 totalling 5.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 5 Chunks of size 512 totalling 2.5KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 7 Chunks of size 1024 totalling 7.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 1280 totalling 1.2KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 14 Chunks of size 2048 totalling 28.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 4096 totalling 12.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 6912 totalling 20.2KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 16384 totalling 48.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 32768 totalling 32.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 147456 totalling 432.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 294912 totalling 864.0KiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 589824 totalling 1.69MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 1179648 totalling 3.38MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 5 Chunks of size 2359296 totalling 11.25MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 3 Chunks of size 4718592 totalling 13.50MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 11 Chunks of size 9437184 totalling 99.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 2 Chunks of size 67108864 totalling 128.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 2 Chunks of size 411041792 totalling 784.00MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:696] 1 Chunks of size 480399360 totalling 458.14MiB
I tensorflow/core/common_runtime/bfc_allocator.cc:700] Sum Total of in-use chunks: 1.46GiB
I tensorflow/core/common_runtime/bfc_allocator.cc:702] Stats:
Limit: 1573257216
InUse: 1573257216
MaxInUse: 1573257216
NumAllocs: 93
MaxAllocSize: 480399360

W tensorflow/core/common_runtime/bfc_allocator.cc:274] ************************************************************************************************xxxx
W tensorflow/core/common_runtime/bfc_allocator.cc:275] Ran out of memory trying to allocate 16.0KiB. See logs for memory state.
W tensorflow/core/framework/op_kernel.cc:993] Resource exhausted: OOM when allocating tensor with shape[4096]
^C^Z
[1]+ Stopped python train.py --hypes hypes/KittiSeg.json`

train.py gives tensorflow ValueError: No variables provided

I try to train the KittiSeg net on my own data, so I have generated Kitti-like groundtruth masks, exported my DATA and RUN directories and created train/val txt files (and put those in KittiSeg.json. When I then run train.py, it starts and initialises the net, but it fails on training with the tensorflow ValueError 'no variables provided'. That does not sound data-set related or so. Do you know what should I update/provide/change to fix that?

(...)
2017-04-06 15:42:59,665 INFO Creating Summary for: score_pool3/biases
2017-04-06 15:42:59,704 INFO Creating Summary for: upscore32/up_filter
Traceback (most recent call last):
  File "train.py", line 131, in <module>
    tf.app.run()
  File "/home/shah/tensorflow/tensorflow_v1.0.0_py3.5_gpu/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train.py", line 127, in main
    train.do_training(hypes)
  File "incl/tensorvision/train.py", line 377, in do_training
    tv_graph = core.build_training_graph(hypes, queue, modules)
  File "incl/tensorvision/core.py", line 100, in build_training_graph
    global_step, learning_rate)
  File "/home/shah/Coding/KittiSeg/hypes/../optimizer/generic_optimizer.py", line 91, in training
    global_step=global_step)
  File "/home/shah/tensorflow/tensorflow_v1.0.0_py3.5_gpu/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 380, in apply_gradients
    raise ValueError("No variables provided.")
ValueError: No variables provided.

possibly related things:

  • I commented out line 123 (train.maybe_download_and_extract(hypes) in train.py because otherwise it would still download kitti;
  • I got the same commentjson import error as issue #28, so I had to import json instead of commentjson in train.py

Could that last one cause some values to be empty or is it something else?

increase descriptions of input files for us lay people

Could you perhaps provide a description of val3.txt and train3.txt? For instance, is the file nomenclature somehow significant?

It is not entirely clear on how one would make their own training images.

I looked at the examples in TensorVision, but it too does not really explain what the masks are. It just labels them GT:

    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_00.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_00_GT.png"
    },
    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_01.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_01_GT.png"
    },
    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_02.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_02_GT.png
}
]

THANKS

ValueError: No variables provided generated by opt.apply_gradients(grads_and_vars, global_step=global_step)

Hi Marvin,

Since I was not able to get the tf.add_n(tf.get_collection(reg_loss_col)) work, I just remove weight_loss from total_loss in kitti_mutliloss.py

total_loss = cross_entropy_mean #+ weight_loss

Then running the program generates the following error,

File "/home/GPU-Study/keras/FCN/kittiseg/tensorvision/train.py", line 386, in do_training
   tv_graph = core.build_training_graph(hypes, queue, modules)
 File "/home/GPU-Study/keras/FCN/kittiseg/tensorvision/core.py", line 100, in build_training_graph
   global_step, learning_rate)
 File "/home/GPU-Study/keras/FCN/kittiseg/hypes/../optimizer/generic_optimizer.py", line 94, in training
   train_op = opt.apply_gradients(grads_and_vars, global_step=global_step)
 File "/devl/tensorflow/tf/lib/python3.4/site-packages/tensorflow/python/training/optimizer.py", line 370, in apply_gradients
   raise ValueError("No variables provided.")
ValueError: No variables provided.

I then printed out tuple(grads_and_vars), which is shown as following. What kind of information it provides, and why it can raise the valueerror of "no variables provided".

-----------------tuple(grads_and_vars)----------------------- ((<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_0:0' shape=(3, 3, 3, 64) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b6d7646fbe0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_1:0' shape=(64,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4822cc0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_2:0' shape=(3, 3, 64, 64) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b6d7646fb38>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_3:0' shape=(64,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b6d7646feb8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_4:0' shape=(3, 3, 64, 128) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4813940>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_5:0' shape=(128,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e48e0c18>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_6:0' shape=(3, 3, 128, 128) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e486da58>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_7:0' shape=(128,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e480b828>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_8:0' shape=(3, 3, 128, 256) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e499a518>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_9:0' shape=(256,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e49e3128>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_10:0' shape=(3, 3, 256, 256) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e49f4ac8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_11:0' shape=(256,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4a48fd0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_12:0' shape=(3, 3, 256, 256) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4a579b0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_13:0' shape=(256,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4ab5dd8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_14:0' shape=(3, 3, 256, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4b31240>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_15:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4b61cc0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_16:0' shape=(3, 3, 512, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4b38cf8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_17:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4bc40b8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_18:0' shape=(3, 3, 512, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4c17f28>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_19:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4bf6f98>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_20:0' shape=(3, 3, 512, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4c95e80>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_21:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4ca4198>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_22:0' shape=(3, 3, 512, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4cd55f8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_23:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4b48278>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_24:0' shape=(3, 3, 512, 512) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4ccc048>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_25:0' shape=(512,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4dac828>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_26:0' shape=(7, 7, 512, 4096) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4d8cef0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_27:0' shape=(4096,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4d5ae80>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_28:0' shape=(1, 1, 4096, 4096) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4e8e208>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_29:0' shape=(4096,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4e8e470>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_30:0' shape=(1, 1, 4096, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4f11da0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_31:0' shape=(2,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4f30ba8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_32:0' shape=(4, 4, 2, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4f93f28>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_33:0' shape=(1, 1, 512, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e4fe45c0>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_34:0' shape=(2,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e50063c8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_35:0' shape=(4, 4, 2, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e5073550>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_36:0' shape=(1, 1, 256, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e50b13c8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_37:0' shape=(2,) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e50dc9e8>), (<tf.Tensor 'Optimizer/training/clip_by_global_norm/Optimizer/training/clip_by_global_norm/_38:0' shape=(16, 16, 2, 2) dtype=float32>, <tensorflow.python.ops.variables.Variable object at 0x2b70e50ceda0>))

when I run demo.py..I get following errors.. I have python 3.5 and tensor flow installed.. Thank you in advance

2017-03-27 00:10:23,039 INFO No environment variable 'TV_PLUGIN_DIR' found. Set to 'C:\Users\Amita/tv-plugins'.
2017-03-27 00:10:23,039 INFO No environment variable 'TV_STEP_SHOW' found. Set to '50'.
2017-03-27 00:10:23,054 INFO No environment variable 'TV_STEP_EVAL' found. Set to '250'.
2017-03-27 00:10:23,054 INFO No environment variable 'TV_STEP_WRITE' found. Set to '1000'.
2017-03-27 00:10:23,054 INFO No environment variable 'TV_MAX_KEEP' found. Set to '10'.
2017-03-27 00:10:23,054 INFO No environment variable 'TV_STEP_STR' found. Set to 'Step {step}/{total_steps}: loss = {loss_value:.2f}; lr = {lr_value:.2e}; {sec_per_batch:.3f} sec (per Batch); {examples_per_sec:.1f} imgs/sec'.
2017-03-27 00:10:23,070 ERROR No input_image was given.
2017-03-27 00:10:23,070 INFO Usage: python demo.py --input_image data/test.png [--output_image output_image] [--logdir /path/to/weights] [--gpus GPUs_to_use]

When I run train.py, I got an import Error

Traceback (most recent call last):
File "train.py", line 18, in
import commentjson
File "C:\Users\hydraz320\Anaconda3\lib\site-packages\commentjson_init_.py", line 1, in
from commentjson import dump
ImportError: cannot import name 'dump'

May I ask that which os you were using? Thanks a lot.

RGB images augmented with additional channels

I want to use images with RGB + additional input channels which have the same width and height as image. I thought of using same pretrained VGG network with additional weights in first layer corresponding to added channels. Required output is still binary segmentation mask.
Is this change feasible on your code? It seems to require delving in TensorVision backend?

How to test my model

Hi, Marvin. Thank you for your KittiSeg and the tutorial. I have use it to train my data, but I don't know how to test the model which has been trained by my data. Thank you very much if you can reply me.

FileNotFoundError: [Errno 2] No such file or directory: 'DATA\\data_road/val3.txt'

Run: python evaluate.py to evaluate the pretrained model

2017-03-15 08:05:37,981 INFO Graph loaded succesfully. Starting evaluation.
2017-03-15 08:05:37,981 INFO Output Images will be written to: RUNS\KittiSeg_pretrained\analyse\images/
Traceback (most recent call last):
  File "evaluate.py", line 122, in <module>
    tf.app.run()
  File "D:\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "evaluate.py", line 110, in main
    ana.do_analyze(logdir)
  File "incl\tensorvision\analyze.py", line 94, in do_analyze
    hypes, sess, image_pl, inf_out)
  File "RUNS\KittiSeg_pretrained\model_files\eval.py", line 61, in evaluate
    with open(data_file) as file:
FileNotFoundError: [Errno 2] No such file or directory: 'DATA\\data_road/val3.txt'

No module named 'seg_utils'

When I try to run demo.py I get the error
ImportError: No module named 'seg_utils'

I am trying to run the code on a Windows 10 machine with tensorflow on GPU.

EOFError when train.py

Hello Marvin,
When I ran train.py, I met this:
2017-05-15 19:54:38,264 INFO No environment variable 'TV_PLUGIN_DIR' found. Set to '/home/liangtingting/tv-plugins'.
2017-05-15 19:54:38,265 INFO No environment variable 'TV_STEP_SHOW' found. Set to '50'.
2017-05-15 19:54:38,265 INFO No environment variable 'TV_STEP_EVAL' found. Set to '250'.
2017-05-15 19:54:38,265 INFO No environment variable 'TV_STEP_WRITE' found. Set to '1000'.
2017-05-15 19:54:38,265 INFO No environment variable 'TV_MAX_KEEP' found. Set to '10'.
2017-05-15 19:54:38,265 INFO No environment variable 'TV_STEP_STR' found. Set to 'Step {step}/{total_steps}: loss = {loss_value:.2f}; lr = {lr_value:.2e}; {sec_per_batch:.3f} sec (per Batch); {examples_per_sec:.1f} imgs/sec'.
2017-05-15 19:54:38,266 INFO f: <open file 'hypes/KittiSeg.json', mode 'r' at 0x7fe97bb2b810>
2017-05-15 19:54:38,267 INFO Initialize training folder
2017-05-15 19:54:38,303 INFO Start training
2017-05-15 19:54:38.304873: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-15 19:54:38.304906: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-15 19:54:38.304919: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "train.py", line 131, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train.py", line 127, in main
train.do_training(hypes)
File "incl/tensorvision/train.py", line 377, in do_training
tv_graph = core.build_training_graph(hypes, queue, modules)
File "incl/tensorvision/core.py", line 85, in build_training_graph
logits = encoder.inference(hypes, image, train=True)
File "/home/liangtingting/KittiSeg/hypes/../encoder/fcn8_vgg.py", line 34, in inference
vgg_fcn = fcn8_vgg.FCN8VGG(vgg16_npy_path=vgg16_npy_path)
File "incl/tensorflow_fcn/fcn8_vgg.py", line 33, in init
self.data_dict = np.load(vgg16_npy_path, encoding='latin1').item()
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 419, in load
pickle_kwargs=pickle_kwargs)
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/format.py", line 640, in read_array
array = pickle.load(fp, **pickle_kwargs)
EOFError

My tensorflow version is 1.0.1, and python version 2.7.12. Can you help me?

Failed to interpret vgg16.npy as pickle

vgg16.txt
Hi Marvin,

Thank you for your efforts in coding all of this up. I was trying to run your demo and am able to download the data_road.zip and extract it successfully using your download_data.py script. However, when I try to run the demo using the demo.py script, I get an error saying that the script failed to interpret "DATA/vgg16.npy" as a pickle. Upon inspection of vgg16.npy, it appears to be downloaded as a dropbox error HTML file. I have attached vgg16.txt since I couldn't attach the .npy file type, but its contents are what is contained in vgg16.npy whenever I download it. I didn't know if you were aware of this error or know of a way to resolve it. Thanks for the help and code!

Issue on mlticlass segmentation

Hello ,
thanks for sharing this amazing work
I'm trying to implement for 5 colors ( black for background , blue , red, green, white ) , I changed the json file in hypes , changed the functions in the input script to load the images and ground truths as you've specified in the doc.
The images got loaded successfully , the problem I got was in calculating the loss of training ('kitti_multiloss.py') if I understood correctly , there was a shape mismatch somewhere , even through I resized my images to the same shape of yours , calculating the loss need changing for multi class seg. ?

thanks again for you work

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.