Closed Brainkite closed 4 years ago
Hi maybe this is easy, you are not opening the test image, so to test a dataset you should set the following lines:
parser.add_argument('--use_dataset', default=True, type=bool) # test: dataset=True single image=FALSE
parser.add_argument('--test_list', default='test_pair.lst',type=str) # for NYUD&BSDS:test_pair.lst, biped msi_test.lst/test_rgb.lst
parser.add_argument('--test_dataset', default='BIPED', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID','DCD'])
parser.add_argument('--dataset_dir',default="/opt/dataset/",type=str) # default:'/opt/dataset/'
I will set better when I have time,
Let me know it worked for you Cheers,
@Brainkite Can you share the checkpoint directory tree ?
@Brainkite Can you share the checkpoint directory tree ?
Yes, please check this issue 14
@Brainkite Can you share the checkpoint directory tree ?
Hi maybe this is easy, you are not opening the test image, so to test a dataset you should set the following lines:
parser.add_argument('--use_dataset', default=True, type=bool) # test: dataset=True single image=FALSE parser.add_argument('--test_list', default='test_pair.lst',type=str) # for NYUD&BSDS:test_pair.lst, biped msi_test.lst/test_rgb.lst parser.add_argument('--test_dataset', default='BIPED', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID','DCD']) parser.add_argument('--dataset_dir',default="/opt/dataset/",type=str) # default:'/opt/dataset/'
I will set better when I have time,
Let me know it worked for you Cheers,
I used these options but did not resolved the problem: here are the run_model.py parameters:
parser.add_argument('--train_dataset', default='BIPED', choices=['BIPED','BSDS'])
parser.add_argument('--test_dataset', default='BIPED', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID','DCD'])
parser.add_argument('--dataset_dir',default='/Users/antoninsumner/Datasets',type=str) # default:'/opt/dataset/'
parser.add_argument('--dataset_augmented', default=True,type=bool)
parser.add_argument('--train_list',default='train_rgb.lst', type=str) # BSDS train_pair.lst, SSMIHD train_rgb_pair.lst/train_rgbn_pair.lst
parser.add_argument('--test_list', default='test_rgb.lst',type=str) # for NYUD&BSDS:test_pair.lst, ssmihd: msi_test.lst/vis_test.lst
parser.add_argument('--trained_model_dir', default='train_2',type=str) # 'trainV2_RN'
# SSMIHD_RGBN msi_valid_list.txt and msi_test_list.txt is for unified test
parser.add_argument('--use_nir', default=False, type=bool)
parser.add_argument('--use_dataset', default=True, type=bool) # test: dataset TRUE single image FALSE
# model config
parser.add_argument('--model_state', default='test', choices=['train','test','None']) # always in None
parser.add_argument('--model_name', default='DXN',choices=['DXN','XCP','None'])
parser.add_argument('--use_v1', default=False,type=bool)
parser.add_argument('--model_purpose', default='edges',choices=['edges','restoration','None'])
parser.add_argument('--batch_size_train',default=8,type=int)
parser.add_argument('--batch_size_val',default=8, type=int)
parser.add_argument('--batch_size_test',default=1,type=int)
parser.add_argument('--checkpoint_dir', default='checkpoints',type=str)
parser.add_argument('--logs_dir', default='logs',type=str)
parser.add_argument('--learning_rate',default=1e-4, type=float) # 1e-4=0.0001
parser.add_argument('--lr_scheduler',default=None,choices=[None,'asce','desc']) # check here
parser.add_argument('--learning_rate_decay', default=0.1,type=float)
parser.add_argument('--weight_decay', default=0.0002, type=float)
parser.add_argument('--model_weights_path', default='vgg16_.npy')
parser.add_argument('--train_split', default=0.9, type=float) # default 0.8
parser.add_argument('--max_iterations', default=150000, type=int) # 100000
parser.add_argument('--learning_decay_interval',default=25000, type=int) # 25000
parser.add_argument('--loss_weights', default=1.0, type=float)
parser.add_argument('--save_interval', default=20000, type=int) # 50000
parser.add_argument('--val_interval', default=30, type=int)
parser.add_argument('--use_subpixel', default=None, type=bool) # None=upsampling with transp conv
parser.add_argument('--deep_supervision', default=True, type= bool)
parser.add_argument('--target_regression',default=True, type=bool) # true
parser.add_argument('--mean_pixel_values', default=[103.939,116.779,123.68, 137.86], type=float)# [103.939,116.779,123.68]
# for Nir pixels mean [103.939,116.779,123.68, 137.86]
parser.add_argument('--channel_swap', default=[2,1,0], type=int)
parser.add_argument('--gpu-limit',default=1.0, type= float, )
parser.add_argument('--use_trained_model', default=False,type=bool) # for vvg16
parser.add_argument('--use_previous_trained', default=True, type=bool)
# image configuration
parser.add_argument('--image_width', default=1280, type=int) # 480 NYUD=560 BIPED=1280 default 400 other 448
parser.add_argument('--image_height', default=720, type=int) # 480 for NYUD 425 BIPED=720 default 400
parser.add_argument('--n_channels', default=3, type=int) # last ssmihd_xcp trained in 512
# test config
parser.add_argument('--test_snapshot', default=149736, type=int) # BIPED: 149736 BSDS:101179
#DexiNedv1=149736,DexiNedv2=149999
parser.add_argument('--testing_threshold', default=0.0, type=float)
parser.add_argument('--base_dir_results',default=None,type=str) # default: '/opt/results/edges'
But I still get the error: Error setting up DexiNed traied model, The passed save_path is not a valid checkpoint: checkpoints/DXN_BIPED/train_2/DXN-149736
WARNING:tensorflow: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see:
WARNING:tensorflow:From run_model.py:80: The name tf.GPUOptions is deprecated. Please use tf.compat.v1.GPUOptions instead.
WARNING:tensorflow:From run_model.py:85: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
WARNING:tensorflow:From run_model.py:85: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.
2020-05-21 15:25:21.311740: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: SSE4.1 SSE4.2 AVX To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags. 2020-05-21 15:25:21.312451: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance. WARNING:tensorflow:From /Users/antoninsumner/Documents/GitHub/DexiNed/models/dexined.py:30: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From /Users/antoninsumner/Documents/GitHub/DexiNed/models/dexined.py:48: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.
WARNING:tensorflow:From /Users/antoninsumner/Documents/GitHub/DexiNed/models/dexined.py:53: conv2d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.keras.layers.Conv2D
instead.
WARNING:tensorflow:From /opt/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/layers/convolutional.py:424: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use layer.__call__
method instead.
WARNING:tensorflow:From /Users/antoninsumner/Documents/GitHub/DexiNed/models/dexined.py:297: conv2d_transpose (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.keras.layers.Conv2DTranspose
instead.
[21 May 2020 15h25m23s][INFO]Build model finished: 2.2905s
WARNING:tensorflow:From /Users/antoninsumner/Documents/GitHub/DexiNed/test.py:37: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.
[21 May 2020 15h25m23s][ERROR] Error setting up DexiNed traied model, The passed save_path is not a valid checkpoint: checkpoints/DXN_BIPED/train_2/DXN-149736 [21 May 2020 15h25m23s][INFO] Enterely testing set-up from /Users/antoninsumner/Datasets/BIPED/edges/test_rgb.lst, size: 50 [21 May 2020 15h25m23s][INFO]testing set-up from /Users/antoninsumner/Datasets/BIPED/edges/test_rgb.lst, size: 50 [21 May 2020 15h25m23s][INFO]Writing PNGs at None Traceback (most recent call last): File "/opt/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "/opt/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/opt/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value Xpt/conv2_block61/kernel [[{{node Xpt/conv2_block61/kernel/read}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_model.py", line 131, in
Original stack trace for 'Xpt/conv2_block61/kernel/read':
File "run_model.py", line 131, in
@Brainkite Can you share the checkpoint directory tree ?
Yes, please check this issue 14
Ok, should I re-order the checkpoint folder as you said? what TF version should I Use, currently I use 1.15
parser.add_argument('--train_dataset', default='BIPED', choices=['BIPED','BSDS']) parser.add_argument('--test_dataset', default='BIPED', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID','DCD']) parser.add_argument('--dataset_dir',default='/Users/antoninsumner/Datasets',type=str) # default:'/opt/dataset/' parser.add_argument('--dataset_augmented', default=True,type=bool) parser.add_argument('--train_list',default='train_rgb.lst', type=str) # BSDS train_pair.lst, SSMIHD train_rgb_pair.lst/train_rgbn_pair.lst parser.add_argument('--test_list', default='test_rgb.lst',type=str) # for NYUD&BSDS:test_pair.lst, ssmihd: msi_test.lst/vis_test.lst parser.add_argument('--trained_model_dir', default='train_2',type=str) # 'trainV2_RN'
SSMIHD_RGBN msi_valid_list.txt and msi_test_list.txt is for unified test
parser.add_argument('--use_nir', default=False, type=bool) parser.add_argument('--use_dataset', default=True, type=bool) # test: dataset TRUE single image FALSE
model config
parser.add_argument('--model_state', default='test', choices=['train','test','None']) # always in None parser.add_argument('--model_name', default='DXN',choices=['DXN','XCP','None']) parser.add_argument('--use_v1', default=False,type=bool) parser.add_argument('--model_purpose', default='edges',choices=['edges','restoration','None']) parser.add_argument('--batch_size_train',default=8,type=int) parser.add_argument('--batch_size_val',default=8, type=int) parser.add_argument('--batch_size_test',default=1,type=int) parser.add_argument('--checkpoint_dir', default='checkpoints',type=str) parser.add_argument('--logs_dir', default='logs',type=str) parser.add_argument('--learning_rate',default=1e-4, type=float) # 1e-4=0.0001 parser.add_argument('--lr_scheduler',default=None,choices=[None,'asce','desc']) # check here parser.add_argument('--learning_rate_decay', default=0.1,type=float) parser.add_argument('--weight_decay', default=0.0002, type=float) parser.add_argument('--model_weightspath', default='vgg16.npy') parser.add_argument('--train_split', default=0.9, type=float) # default 0.8 parser.add_argument('--max_iterations', default=150000, type=int) # 100000 parser.add_argument('--learning_decay_interval',default=25000, type=int) # 25000 parser.add_argument('--loss_weights', default=1.0, type=float) parser.add_argument('--save_interval', default=20000, type=int) # 50000 parser.add_argument('--val_interval', default=30, type=int) parser.add_argument('--use_subpixel', default=None, type=bool) # None=upsampling with transp conv parser.add_argument('--deep_supervision', default=True, type= bool) parser.add_argument('--target_regression',default=True, type=bool) # true parser.add_argument('--mean_pixel_values', default=[103.939,116.779,123.68, 137.86], type=float)# [103.939,116.779,123.68]
for Nir pixels mean [103.939,116.779,123.68, 137.86]
parser.add_argument('--channel_swap', default=[2,1,0], type=int) parser.add_argument('--gpu-limit',default=1.0, type= float, ) parser.add_argument('--use_trained_model', default=False,type=bool) # for vvg16 parser.add_argument('--use_previous_trained', default=True, type=bool)
image configuration
parser.add_argument('--image_width', default=1280, type=int) # 480 NYUD=560 BIPED=1280 default 400 other 448 parser.add_argument('--image_height', default=720, type=int) # 480 for NYUD 425 BIPED=720 default 400 parser.add_argument('--n_channels', default=3, type=int) # last ssmihd_xcp trained in 512
test config
parser.add_argument('--test_snapshot', default=149736, type=int) # BIPED: 149736 BSDS:101179
DexiNedv1=149736,DexiNedv2=149999
parser.add_argument('--testing_threshold', default=0.0, type=float) parser.add_argument('--base_dir_results',default=None,type=str) # default: '/opt/results/edges'
Hi sorry I am a little busy. My train configuration will be like:
parser.add_argument('--train_dataset', default='BSDS', choices=['BIPED','BSDS']) # if you are training on BSDS so the train dataset should be BSDS
parser.add_argument('--test_dataset', default='BSDS', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID','DCD']) # during training it take 10% of BSDS so BSDS
parser.add_argument('--dataset_dir',default='/Users/antoninsumner/Datasets',type=str) # default:'/opt/dataset/'
parser.add_argument('--dataset_augmented', default=True,type=bool)
parser.add_argument('--train_list',default='train_rgb.lst', type=str) # BSDS train_pair.lst, SSMIHD train_rgb_pair.lst/train_rgbn_pair.lst
parser.add_argument('--test_list', default='test_rgb.lst',type=str) # for NYUD&BSDS:test_pair.lst, ssmihd: msi_test.lst/vis_test.lst
parser.add_argument('--trained_model_dir', default='train_2',type=str) # the last checkpoint is into train_2 and the test_snapshot should be 149999 (for testing)
# SSMIHD_RGBN msi_valid_list.txt and msi_test_list.txt is for unified test
parser.add_argument('--use_nir', default=False, type=bool)
parser.add_argument('--use_dataset', default=True, type=bool) # test: dataset TRUE single image FALSE
# model config
parser.add_argument('--model_state', default='train', choices=['train','test','None']) # always in None
parser.add_argument('--model_name', default='DXN',choices=['DXN','XCP','None'])
parser.add_argument('--use_v1', default=False,type=bool)
parser.add_argument('--model_purpose', default='edges',choices=['edges','restoration','None'])
parser.add_argument('--batch_size_train',default=8,type=int)
parser.add_argument('--batch_size_val',default=8, type=int)
parser.add_argument('--batch_size_test',default=1,type=int)
parser.add_argument('--checkpoint_dir', default='checkpoints',type=str)
parser.add_argument('--logs_dir', default='logs',type=str)
parser.add_argument('--learning_rate',default=1e-4, type=float) # 1e-4=0.0001
parser.add_argument('--lr_scheduler',default=None,choices=[None,'asce','desc']) # check here
parser.add_argument('--learning_rate_decay', default=0.1,type=float)
parser.add_argument('--weight_decay', default=0.0002, type=float)
parser.add_argument('--model_weights_path', default='vgg16_.npy')
parser.add_argument('--train_split', default=0.9, type=float) # default 0.8
parser.add_argument('--max_iterations', default=150000, type=int) # 100000
parser.add_argument('--learning_decay_interval',default=25000, type=int) # 25000
parser.add_argument('--loss_weights', default=1.0, type=float)
parser.add_argument('--save_interval', default=20000, type=int) # 50000
parser.add_argument('--val_interval', default=30, type=int)
parser.add_argument('--use_subpixel', default=None, type=bool) # None=upsampling with transp conv
parser.add_argument('--deep_supervision', default=True, type= bool)
parser.add_argument('--target_regression',default=True, type=bool) # true
parser.add_argument('--mean_pixel_values', default=[103.939,116.779,123.68, 137.86], type=float)# [103.939,116.779,123.68]
# for Nir pixels mean [103.939,116.779,123.68, 137.86]
parser.add_argument('--channel_swap', default=[2,1,0], type=int)
parser.add_argument('--gpu-limit',default=1.0, type= float, )
parser.add_argument('--use_trained_model', default=False,type=bool) # for vvg16
parser.add_argument('--use_previous_trained', default=True, type=bool)
# image configuration
parser.add_argument('--image_width', default=400, type=int) # 480 NYUD=560 BIPED=1280 default 400 other 448
parser.add_argument('--image_height', default=400, type=int) # 480 for NYUD 425 BIPED=720 default 400
parser.add_argument('--n_channels', default=3, type=int) # last ssmihd_xcp trained in 512
# test config
parser.add_argument('--test_snapshot', default=None, type=int) # BIPED: 149736 BSDS:101179
#DexiNedv1=149736,DexiNedv2=149999
parser.add_argument('--testing_threshold', default=0.0, type=float)
parser.add_argument('--base_dir_results',default=None,type=str) # default: '/opt/results/edges'
while training image_width and height are the same size 400, and test_snapshot is None to train from scratch. I trained in tensorflow 1.13.1, and I did the last prediction (test) 1.15.2.
The parser has some of the unused arguments, I will clean this part. If you are familiar with Pytorch you can use DexiNed-Pytorch. Yes, I need to clean the data managing part sorry :(
Xavier
Okay, I wend on implementing Dexined reusing only model.py from the PyTorch implementation. I just have 2 questions: QUESTION_1: The model outputs a list of 7 edge_maps. In the paper, you mention a "fused" (DexiNed-f) version and an "averaged" (Dexined-a) version of the model. Does "fused" refers to the summation of all 7 outputs and "averaged" the average?
QUESTION_2: You talk about initializing the weight of each fusion layer to 1/N-1 (4.4. Implementation Notes). It seems that in the pytorch implementation those weights are initialized to 1/bs (bs=batch_size) Am I right? Unless I missunderstood this part of the paper.
Okay, I wend on implementing Dexined reusing only model.py from the PyTorch implementation. I just have 2 questions: QUESTION_1: The model outputs a list of 7 edge_maps. In the paper, you mention a "fused" (DexiNed-f) version and an "averaged" (Dexined-a) version of the model. Does "fused" refers to the summation of all 7 outputs and "averaged" the average?
Actually no, Dexined-f is the in-model fused edge-map, and Dexined-a is the average of all outputs (7 outputs).
QUESTION_2: You talk about initializing the weight of each fusion layer to 1/N-1 (4.4. Implementation Notes). It seems that in the pytorch implementation those weights are initialized to 1/bs (bs=batch_size)
If you go to line 426 main.py you will find 0.2 which is 1/N-1 cheers.
Am I right? Unless I missunderstood this part of the paper.
Ok great thank you! How do you set the weights of each scale for the loss function? In the pytorch implementation, all weights are the same.
Also how do you compute the metrics in the paper ODS, OIS and AP?
Ok great thank you! How do you set the weights of each scale for the loss function? In the pytorch implementation, all weights are the same.
Also how do you compute the metrics in the paper ODS, OIS, and AP?
In this case, the weights are the same 1.0, we did not test with different weights.
Whi respect to the quantitative evaluation you can find in this #8
I trained the model on the BSDS500 dataset and wanted to test it in the BIPED dataset but when use_previous_trained is True the implementation only wants to use a DXN_BIPED checkpoint folder. And if I rename my checkpoint folder to match I get a "not a valid checkpoint error"