vinthony / ghost-free-shadow-removal

[AAAI 2020] Towards Ghost-free Shadow Removal via Dual Hierarchical Aggregation Network and Shadow Matting GAN
https://arxiv.org/abs/1911.08718
297 stars 59 forks source link

Replacing vgg verydeep 19 with another model #34

Open ahrooran-r opened 2 years ago

ahrooran-r commented 2 years ago

Hi,

It seems vgg-19-verydeep is resource hungry. So I wanted to replace it with another simple model. I tried vgg-16-verydeep and vgg-f in the same web page you mentioned in the md file.

They both throw the error:

AttributeError                            Traceback (most recent call last)

C:\Users\MSIUSE~1\AppData\Local\Temp/ipykernel_11632/952543688.py in <module>
      1 with tf.variable_scope(tf.get_variable_scope()):
      2     input=tf.placeholder(tf.float32,shape=[None,None,None,3])
----> 3     shadow_free_image=build_aggasatt_joint(input,64,vgg19_path)
      4 
      5 sess=tf.Session()

E:\Semester 7 - Moodle 2021\FYP\projects\DHAN\networks.py in build_aggasatt_joint(input, channel, vgg_19_path)
    154 def build_aggasatt_joint(input, channel=64, vgg_19_path='None'):
    155     print("[i] Hypercolumn ON, building hypercolumn features ... ")
--> 156     vgg19_features = build_vgg19(input[:, :, :, 0:3] * 255.0, vgg_19_path)
    157     for layer_id in range(1, 6):
    158         vgg19_f = vgg19_features['conv%d_2' % layer_id]

E:\Semester 7 - Moodle 2021\FYP\projects\DHAN\networks.py in build_vgg19(input, vgg_path, reuse)
     99         net['conv3_2'] = build_net('conv', net['conv3_1'], get_weight_bias(vgg_layers, 12), name='vgg_conv3_2')
    100         net['conv3_3'] = build_net('conv', net['conv3_2'], get_weight_bias(vgg_layers, 14), name='vgg_conv3_3')
--> 101         net['conv3_4'] = build_net('conv', net['conv3_3'], get_weight_bias(vgg_layers, 16), name='vgg_conv3_4')
    102         net['pool3'] = build_net('pool', net['conv3_4'])
    103         net['conv4_1'] = build_net('conv', net['pool3'], get_weight_bias(vgg_layers, 19), name='vgg_conv4_1')

E:\Semester 7 - Moodle 2021\FYP\projects\DHAN\networks.py in get_weight_bias(vgg_layers, i)
     41     weights = tf.constant(weights)
     42     bias = vgg_layers[i][0][0][2][0][1]
---> 43     bias = tf.constant(np.reshape(bias, (bias.size)))
     44     return weights, bias
     45 

AttributeError: 'str' object has no attribute 'size'

Isn't it supposed to work without any modifications to the code? If not how can I modify the code to try all the models mentioned in the website. Can you give me any pointers on how to work on this.

I'm new to this. So please forgive me if I sound too dumb. :)