Comments (2)
Same error here. I wonder if the author could be so kind to explain why np.squeeze
and numpy.expand_dims
were used consecutively? And It does seem some operation creates extra dimension that eventually caused the error above.
Thanks,
from visualizing-and-understanding-convolutional-neural-networks.
当 exec
deconv = visualize(model, img_array, layer_name, feature_to_visualize, visualize_mode)
有一个 InvalidArgumentError `InvalidArgumentError Traceback(最近一次调用最后) 在 1 deconv = 可视化(模型,img_array, ----> 2 layer_name,feature_to_visualize,visualize_mode)在可视化(模型,数据,layer_name,feature_to_visualize,visualize_mode) 29 deconv_layers[0].up(data) 30 for i in range(1, len(deconv_layers)): ---> 31 deconv_layers[i].up(deconv_layers [i - 1].up_data) 32 33 输出 = deconv_layers[-1].up_data
in up(self, data, learning_phase) 34 def up(self, data, learning_phase = 0): 35 #Forward pass ---> 36 self.up_data = self.up_func([data, learning_phase]) 37 self.up_data= np.squeeze(self.up_data,axis=0) 38 self.up_data=numpy.expand_dims(self.up_data,axis=0)
~/anaconda3/envs/tfEnv/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in call (self, inputs) 2713 return self._legacy_call(inputs) 2714 -> 2715 return self._call(inputs ) 2716 else: 2717 if py_any(is_tensor(x) for x in inputs):
~/anaconda3/envs/tfEnv/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in _call(self, inputs) 2673 fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata) 2674 else : -> 2675 fetched = self._callable_fn(*array_vals) 2676 return fetched[:len(self.outputs)] 2677
~/anaconda3/envs/tfEnv/lib/python3.6/site-packages/tensorflow/python/client/session.py in call (self, *args, **kwargs) 1380 ret = tf_session.TF_SessionRunCallable( 1381 self._session ._session, self._handle, args, status, -> 1382 run_metadata_ptr) 1383 if run_metadata: 1384 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
~/anaconda3/envs/tfEnv/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py in exit(self, type_arg, value_arg, traceback_arg) 517 None, None, 518 compat.as_text(c_api.TF_Message(self.status.status)), --> 519 c_api.TF_GetCode(self.status.status)) 520 # Delete the underlying status object from memory otherwise it stays alive 521 # as there is a reference to status from this from the traceback due to
InvalidArgumentError: transpose 需要一个大小为 6 的向量。但 input(1) 是一个大小为 4 的向量 [[Node: conv2d_84/Conv2D-0-TransposeNHWCToNCHW-LayoutOptimizer = Transpose[T=DT_FLOAT, Tperm=DT_INT32, _device="/job :localhost/replica:0/task:0/device:GPU:0"](_arg_input_85_0_0/_1345, PermConstNHWCToNCHW-LayoutOptimizer)]]`
Encountered the same problem, have you solved i
from visualizing-and-understanding-convolutional-neural-networks.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from visualizing-and-understanding-convolutional-neural-networks.