dongheehand / deblurgan-tf Goto Github PK
View Code? Open in Web Editor NEWTensorflow implementation of DeblurGAN(Blind Motion Deblurring Using Conditional Adversarial Networks)
Tensorflow implementation of DeblurGAN(Blind Motion Deblurring Using Conditional Adversarial Networks)
Do you encounter thre issue?
How to solve it?
Thanks!
I try and deblur my own image with the pre-trained model files and hit:
Instructions for updating:
Use standard file APIs to check for files with this prefix.
Traceback (most recent call last):
File "main.py", line 77, in <module>
test_only(args, model, sess, saver)
File "/home/user/test2/DeblurGAN-tf/mode.py", line 157, in test_only
saver.restore(sess,args.pre_trained_model)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1292, in restore
err, "a Variable name or other graph key that is missing")
tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Tensor name "discriminator/conv00/bias" not found in checkpoint files /home/user/model/DeblurrGAN_last.index
[[node save/RestoreV2 (defined at main.py:66) ]]
Caused by op u'save/RestoreV2', defined at:
File "main.py", line 66, in <module>
saver = tf.train.Saver(max_to_keep = None)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 832, in __init__
self.build()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 844, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 881, in _build
build_save=build_save, build_restore=build_restore)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 513, in _build_internal
restore_sequentially, reshape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 332, in _AddRestoreOps
restore_sequentially)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 580, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 1572, in restore_v2
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1801, in __init__
self._traceback = tf_stack.extract_stack()
NotFoundError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Tensor name "discriminator/conv00/bias" not found in checkpoint files /home/user/model/DeblurrGAN_last.index
[[node save/RestoreV2 (defined at main.py:66) ]]
Thank you for providing the TF code! But I have another question and I look forward to your help. I want to replace the data set with GOPRO_Large and generate paired training data. However, an error is reported while running your GOPRO_preprocess.py. How should I change the code in the GOPRO_preprocess.py file?
Take the liberty and look forward to your reply.
hello,I'd like to ask,why resize the image to 640*360???
It wasn't clear to me what to do to deblur an image using the provided pre-trained model. I'm still fairly new to coding and computer vision. Here's what I had to do to make it work.
DeblurGAN-tf
folder.I updated whichever tf
modules were stated as missing in the error messages.
From:
tf.placeholder
To:
tf.compat.v1.placeholder
I also added the following code in whichever file used tf.placeholder
. I placed it at the top after the imports section. Apparently, the placeholder doesn't work with eager execution.
tf.compat.v1.disable_eager_execution()
result
and model
folder in the DeblurGAN-tf
directory. The default settings are stated in the "main.py" file from line 20 to 28.--train_Sharp_path
, --train_Blur_path
, --test_Sharp_path
, --test_Blur_path
, --vgg_path
, --patch_size
, --result_path
, --model_path
I extracted the pre-trained model files into the model
folder. The command in the docs to extract the tar file didn't work. It ended up creating a new tar file. Instead, I double-clicked on the tar file to manually extract it. The And, I referenced the model file path in the command-line interface as ./model/DeblurrGAN_last
without the extension.
Mac OS: Stop the .DS_Store
file from being loaded in the image folder. Add the following code to the image_loader
function in theutil.py
file in the DeblurGAN-tf
folder.
FROM:
def image_loader(image_path, load_x, load_y, is_train = True):
imgs = sorted(os.listdir(image_path))
img_list = []
for ele in imgs:
img = Image.open(os.path.join(image_path, ele))
if is_train:
img = img.resize((load_x, load_y), Image.BICUBIC)
img_list.append(np.array(img))
return img_list
ADD:
for name in imgs:
if name.endswith("DS_Store"):
imgs.remove(name)
TO:
def image_loader(image_path, load_x, load_y, is_train = True):
imgs = sorted(os.listdir(image_path))
for name in imgs:
print(name)
if name.endswith("DS_Store"):
imgs.remove(name)
img_list = []
for ele in imgs:
img = Image.open(os.path.join(image_path, ele))
if is_train:
img = img.resize((load_x, load_y), Image.BICUBIC)
img_list.append(np.array(img))
return img_list
When I test a small image, it occure this error.
InvalidArgumentError (see above for traceback): Incompatible shapes: [1,48,44,3] vs. [1,47,41,3]
[[node generator/add_32 (defined at /home/ares2/workspace/DeblurGAN-tf/Deblur_Net.py:79) = Add[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](generator/Tanh-0-0-TransposeNCHWToNHWC-LayoutOptimizer, sub)]]
Does it only test the input size (1280, 720) ?
Thanks!
why the content loss is so big when training?
!python 'drive/My Drive/Pretrained/DeblurGAN-tf/main.py' --mode test_only --pre_trained_model 'drive/My Drive/Pretrained/DeblurrGAN_last.index' --test_Blur_path 'drive/My Drive/Rafting/'
ValueError: The passed save_path is not a valid checkpoint: drive/My Drive/Pretrained/DeblurrGAN_last.index
I think there should be a meta file in addition to the two files in trained model
Q1:Why D-loss is negative and G-loss is very big?
Q2:Why did the training seem to have ended in an epoch, and it took many hours to start training again. Then the multiples of this epoch seem to have ended. After many hours, train again?
Q3:What does in_memory mean and how to understand?
Can you provide some intermediate deblurring results during training, eg, epoch 1,30,150 etc?
Set Batchsize to 16,ValueError: Dimensions must be equal, but are 8 and 16 for 'discriminator_2/sub_1' (op: 'Sub') with input shapes: [16,?,8,128], [16,128].I looked at the code carefully and couldn't figure out where the problem was?thank you!
Sorry to disturb you.
I just use your code and released pretrained model on the 1111 testing images (1280*720) of GOPRO, but the PSNR and SSIM are 25.7 and 0.74 respectively, whcih are far lower than the original paper.
Is that normal?
Looking forward your reply, thanks~
안녕하세요. 잘 보았습니다. 도움이 많이 되었습니다.
다름이 아니라 해당 라인 에서 VGG_MEAN은 랜덤으로 1000개가 뽑혀진 GoPro 1000개 이미지 마다 새로 갱신되어야 하는 줄 알았는데..
Pretrained 된 이미지넷 데이터 셋의 평균 값을 말하는 것이지요?.
추가적으로 in_memory가 어떤 옵션인가요? 아무리 생각해도 어떤 옵션인지 잘 이해가 되지가 않아서요.
감사합니다.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.