-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
11.1 Detecting Multiple Images -- TypeError: add_weight() got multiple values for argument 'name' #73
Comments
During running the example application, I found out the outstanding 'scipy.misc' issues. I am pleased to give the related solutions ad follows. 1. imread, imsaveIssueImportError: cannot import name 'imread' and 'imsave 'from 'scipy.misc' SolutionFirst, install imageio $ conda install imageio Second, change imageio at conda: https://github.com/conda-forge/imageio-feedstock 2. imresizeIssueImportError: cannot import name 'imresize' from 'scipy.misc' SolutionFirst, install scikit-image $ conda install -c conda-forge scikit-image Second, scikit-image: https://scikit-image.org/docs/dev/install.html 3. fromimage, toimageIssueImportError: cannot import name 'fromimage' from 'scipy.misc' SolutionAopt the numpy method: Adopt the pillow method Image.fromarray(): stackoverflow: https://stackoverflow.com/questions/57796368/attributeerror-importerror-on-scipy-misc-image-functions-e-x-imread-imresize |
Hi Douwe: It is a long journey. A good news is that I have gotten through the error: TypeError: add_weight() got multiple values for argument 'name' However, I have not yet completed to run the application due to the function of format_img. It shows: NameError: name 'format_img' is not defined. I check both CV2 and PIL, there is no traceback for such an error. Since keras_rfcnn is a classical case called by the application of 11.1 Detecting Multiple Images. I want to figure out it. Hope you can give a help. Appreciate for your reply,
NameError Traceback (most recent call last) NameError: name 'format_img' is not defined_ |
After adding the following code "from measure_map import format_img", there is no TypeError: add_weight() got multiple values for argument 'name'. However, it has the TypeError: Object of type 'NoneType' has no len(). So I have added the issue 11.2 |
Hi Douwe:
I adopted the code of kbardool/keras-frcnn after yhenon/keras-frcnn was deprecated and deleted in the Github. While running the script of train_frcnn.py, the system raised TypeError: add_weight() got multiple values for argument 'name'.
I am pleased to provide the Snippet of the code, detailed TypeError Message and related environment code of lines for your information.
1. Snippet of the code
Since Keras was updated, I have changed the line of code from" if K.image_dim_ordering() == 'th':" to "if K.image_data_format() == 'channels_first':"
2. TypeError Message
TypeError Traceback (most recent call last)
in
17
18 # define the base network (resnet here, can be VGG, Inception, etc)
---> 19 shared_layers = nn.nn_base(img_input, trainable=True)
20
21 # define the RPN, built on the base layers
~/keras-frcnn/keras_frcnn/resnet.py in nn_base(input_tensor, trainable)
190 # Do not correct "trainable = trainable" to "trainable=True"
191 x = Convolution2D(64, (7, 7), strides=(2, 2), name='conv1', trainable=trainable)(x)
--> 192 x = FixedBatchNormalization(axis=bn_axis, name='bn_conv1')(x)
193 x = Activation('relu')(x)
194 x = MaxPooling2D((3, 3), strides=(2, 2))(x)
~/miniconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs)
73 if _SYMBOLIC_SCOPE.value:
74 with get_graph().as_default():
---> 75 return func(*args, **kwargs)
76 else:
77 return func(*args, **kwargs)
~/miniconda3/lib/python3.7/site-packages/keras/engine/base_layer.py in call(self, inputs, **kwargs)
461 'You can build it manually via: '
462 '
layer.build(batch_input_shape)
')--> 463 self.build(unpack_singleton(input_shapes))
464 self.built = True
465
~/keras-frcnn/keras_frcnn/FixedBatchNormalization.py in build(self, input_shape)
28 regularizer=self.gamma_regularizer,
29 name='{}_gamma'.format(self.name),
---> 30 trainable=False)
31 self.beta = self.add_weight(shape,
32 initializer=self.beta_init,
TypeError: add_weight() got multiple values for argument 'name'
3. Related Snippet of FixedBatchNormalization.py
I checked the FRCNN code. It is related to FixedBatchNormalization.py.
Here is the website that I have referenced.
keras-frcnn: https://github.com/kbardool/keras-frcnn
deprecated yhenon: https://github.com/yhenon/keras-frcnn
Look forward to hearing from you,
Best regards,
Mike``
The text was updated successfully, but these errors were encountered: