Skip to content
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

How to convert this model to inpaint gray picture #86

Open
Frankie0403 opened this issue Mar 16, 2023 · 2 comments
Open

How to convert this model to inpaint gray picture #86

Frankie0403 opened this issue Mar 16, 2023 · 2 comments

Comments

@Frankie0403
Copy link

No description provided.

@Frankie0403 Frankie0403 changed the title How to convert this model How to convert this model to inpaint gray picture Mar 16, 2023
@Frankie0403
Copy link
Author

I try to inpaint some gray pics(with 1 channel not 3), and I costom the VGG16 model(change the input shape) and use my weight instead of 'Imagenet' because of the channel num. And the problem is that when the code goes to
'''
model.compile(
optimizer = Adam(lr=lr),
loss=self.total_loss(inputs_mask)
)
'''
I received this error message:
‘’‘
InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: You must feed a value for placeholder tensor 'outputs_img_target' with dtype float and shape [?,?,?,?]
[[{{node outputs_img_target}}]]
[[outputs_img_target/_417]]
(1) Invalid argument: You must feed a value for placeholder tensor 'outputs_img_target' with dtype float and shape [?,?,?,?]
[[{{node outputs_img_target}}]]
0 successful operations.
0 derived errors ignored.
’‘’
It seems that I didn't pass the y_true but why?

@majorbedhead
Copy link

Error Message Breakdown
InvalidArgumentError: This is the type of error being thrown. An InvalidArgumentError in TensorFlow typically means that a function or operation was called with an argument that has an unexpected value or type.

Placeholder tensor 'outputs_img_target' with dtype float and shape [?,?,?,?]:

Placeholder tensor: In TensorFlow, a placeholder is essentially a variable that you will assign data to at a later point. It allows you to create operations and build your computation graph, without needing the data. In TensorFlow 2.x, placeholders are less commonly used directly, as the eager execution mode tends to be the default behavior, which does not require placeholders in the same way TensorFlow 1.x did.
'outputs_img_target': This is the name of the placeholder tensor that the error message is about. It seems to be expected to hold the target image data (or something related to images), judging by the name.
dtype float: This indicates that the expected data type for this tensor is a floating-point number. Most image data, after being processed (normalized or standardized), is represented as floats.
shape [?,?,?,?]: This indicates the expected shape of the tensor, where each ? represents a dimension whose size is not specified. In the context of image data, these dimensions typically represent [batch_size, height, width, channels], but the specific sizes are not fixed here, which is common in models that are designed to be flexible with respect to input size.
You must feed a value for placeholder tensor: This part of the message is telling you that when the operation was attempted, the outputs_img_target tensor was expected to have been given a value (i.e., some data), but it wasn't. In a running session, every placeholder that is going to be used in the computation must be fed with data, usually via a feed_dict in TensorFlow 1.x or through function arguments in TensorFlow 2.x.

Possible Causes and Solutions
Not Feeding Data: If you're using TensorFlow 1.x, you might have forgotten to provide the value for outputs_img_target through the feed_dict parameter when you ran your session. If you're using TensorFlow 2.x, it could be that the function or method expecting this data was not passed the necessary argument.

Model Architecture/Execution Mismatch: Ensure that the way you're attempting to use the model matches its intended architecture. If the model expects an image target for training or inference, you need to supply this in the correct format.

Version Mismatch: If you're translating code from TensorFlow 1.x to 2.x (or vice versa), be aware that their handling of placeholders and execution models are quite different. TensorFlow 2.x encourages the use of eager execution and tf.data pipelines for data feeding, moving away from the explicit use of placeholders.

Next Steps
Verify Data Feeding: Double-check how you're supplying data to your model, especially focusing on the outputs_img_target tensor. Ensure it's being fed appropriate values wherever the model expects them.

Review Model Code: Look at the model's documentation or code comments to understand the expected format and contents of outputs_img_target.

Debugging and Testing: Simplify your code to a minimal example that still produces the error, which can often reveal where things are going wrong.

Let me know if this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants