vinthony / ghost-free-shadow-removal

[AAAI 2020] Towards Ghost-free Shadow Removal via Dual Hierarchical Aggregation Network and Shadow Matting GAN

Home Page:https://arxiv.org/abs/1911.08718

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in demo

naoto0804 opened this issue · comments

Thank you for making the codes publicly available!
When I run the first cell of demo.ipynb on Python3+TF1.15, the following error happened. Am I missing something? It seems that vgg_path is not a dictionary object.

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.
[i] Hypercolumn ON, building hypercolumn features ... 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-e9ba2ee3867a> in <module>
     20 with tf.variable_scope(tf.get_variable_scope()):
     21     input=tf.placeholder(tf.float32,shape=[None,None,None,3])
---> 22     shadow_free_image=build_aggasatt_joint(input,64,vgg19_path)
     23 
     24 sess=tf.Session()

/raid/home/inoue/shadow/prev_methods/ghost-free-shadow-removal/networks.py in build_aggasatt_joint(input, channel, vgg_19_path)
    140 def build_aggasatt_joint(input,channel=64,vgg_19_path='None'):
    141     print("[i] Hypercolumn ON, building hypercolumn features ... ")
--> 142     vgg19_features=build_vgg19(input[:,:,:,0:3]*255.0,vgg_19_path)
    143     for layer_id in range(1,6):
    144         vgg19_f = vgg19_features['conv%d_2'%layer_id]

/raid/home/inoue/shadow/prev_methods/ghost-free-shadow-removal/networks.py in build_vgg19(input, vgg_path, reuse)
     80             tf.get_variable_scope().reuse_variables()
     81         net={}
---> 82         vgg_layers=vgg_path['layers'][0]
     83         net['input']=input-np.array([123.6800, 116.7790, 103.9390]).reshape((1,1,1,3))
     84         net['conv1_1']=build_net('conv',net['input'],get_weight_bias(vgg_layers,0),name='vgg_conv1_1')

TypeError: string indices must be integers

Hi
Thanks for your attention.

When I update the training code, I deleted a line by mistake.

the build_vgg19 should be :

def build_vgg19(input,vgg_path,reuse=False):
    vgg_path=scipy.io.loadmat(vgg_path)
    with tf.variable_scope("vgg19"):

I will fix this error ASAP when I close this issue.

Fixed。

Cool, thanks!

Hey!I am not able to import 'build_aggasatt_joint' from networks.
Error is:ImportError: cannot import name 'build_aggasatt_joint'
I searched online..but i am unable to find anything.What am i supposed to do?

@poojak-shetty Hi, thanks for your attention.

This error is often about the package importing in python.

  1. please make sure you use the correct python version(3.x)
  2. please make sure your code with the same folder as network.py
  3. please check the line for importing, such as
    from networks import *

@vinthony Thankyou!It worked

Hey, Thank you for providing the code.

i am getting this issue:

def build_vgg19(input,vgg_path,reuse=False):
---> 79 vgg_path=scipy.io.loadmat(vgg_path)
80 with tf.compat.v1.VariableScope("vgg19"):
81 if reuse:

AttributeError: module 'tensorflow' has no attribute 'variable_scope'

Although, i have changed to tf.compat.v1.VariableScope

please check..!