此处将为大家介绍关于【tensorFlow】tf.reshape()报错信息-TypeError:Expectedbinaryorunicodestring的详细内容,并且为您解答有关importte
此处将为大家介绍关于【tensorFlow】tf.reshape()报错信息 - TypeError: Expected binary or unicode string的详细内容,并且为您解答有关import tensorflow as tf报错的相关问题,此外,我们还将为您介绍关于'TypeError at /api/chunked_upload/ Unicode-objects must be encoding before hashing' 在 Django 项目中使用 botocore 时出错、angular6.1.0 运行时报错 ERROR in node_modules/rxjs/internal/types.d.ts (81,44): error TS1005: '';'' expected.、AttributeError: 'tuple' 对象在 tensorflow 中没有属性 'shape' :-> y_t_rank = len(y_t.shape.as_list())、Error during WebSocket handshake: Unexpected response code: 200的有用信息。
本文目录一览:- 【tensorFlow】tf.reshape()报错信息 - TypeError: Expected binary or unicode string(import tensorflow as tf报错)
- 'TypeError at /api/chunked_upload/ Unicode-objects must be encoding before hashing' 在 Django 项目中使用 botocore 时出错
- angular6.1.0 运行时报错 ERROR in node_modules/rxjs/internal/types.d.ts (81,44): error TS1005: '';'' expected.
- AttributeError: 'tuple' 对象在 tensorflow 中没有属性 'shape' :-> y_t_rank = len(y_t.shape.as_list())
- Error during WebSocket handshake: Unexpected response code: 200
【tensorFlow】tf.reshape()报错信息 - TypeError: Expected binary or unicode string(import tensorflow as tf报错)
今天在使用tensoflow跑cifar10的CNN分类时候,download一个源码,但是报错
TypeError: Failed to convert object of type <class ''list''> to Tensor. Contents: [-1, Dimension(4608)]. Consider casting elements to a supported type.
跟踪发现是tf.reshape()时候报错!
1 flatten_shape = input.get_shape()[1] * input.get_shape()[2] * input.get_shape()[3]
2 return tf.reshape(input, [-1, flatten_shape], name="flatten")
这里需要改成
flatten_shape = input.get_shape().as_list()[1] * input.get_shape().as_list()[2] * input.get_shape().as_list()[3]
return tf.reshape(input, [-1, flatten_shape], name="flatten")
需要使用.as_list()将获取到的shape转换成list才行。
'TypeError at /api/chunked_upload/ Unicode-objects must be encoding before hashing' 在 Django 项目中使用 botocore 时出错
如何解决''TypeError at /api/chunked_upload/ Unicode-objects must be encoding before hashing'' 在 Django 项目中使用 botocore 时出错?
我遇到了这个问题的死胡同。我的代码在开发中运行良好,但是当我部署我的项目并配置 DigitalOcean Spaces & S3 存储桶时,上传媒体时出现以下错误:
类型错误在 /api/chunked_upload/ Unicode 对象必须在散列之前编码
我正在使用 django-chucked-uploads 并且它不能很好地与 Botocore 配合使用 我使用的是 Python 3.7
我的代码取自这个演示:https://github.com/juliomalegria/django-chunked-upload-demo
任何帮助都会有很大帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
angular6.1.0 运行时报错 ERROR in node_modules/rxjs/internal/types.d.ts (81,44): error TS1005: '';'' expected.
angular6.1.0 运行时报错 ERROR in node_modules/rxjs/internal/types.d.ts (81,44): error TS1005: '';'' expected. node_modules/rxjs/internal/types.d.ts (81,74): error TS1005: '';'' expected. node_modules/rxjs/internal/t
解决方法:
在package.json文件里面
修改 "rxjs": "^6.0.0"
为 "rxjs": "6.0.0",然后在项目中运行npm update
AttributeError: 'tuple' 对象在 tensorflow 中没有属性 'shape' :-> y_t_rank = len(y_t.shape.as_list())
如何解决AttributeError: ''tuple'' 对象在 tensorflow 中没有属性 ''shape'' :-> y_t_rank = len(y_t.shape.as_list())?
Output shape from model.summary()
Heat map Shape
这是我的火车函数,其中定义了 generator
。
def train(self,batch_size,model_path,epochs):
train_dataset = MPIIDataGen("C:/Users/srira/Desktop/hourglass_keras-master/data/mpii/mpii_annotations.json","C:/Users/srira/Desktop/hourglass_keras-master/data/mpii/images",inres=self.inres,outres=self.outres,is_train=True )
train_gen = train_dataset.generator(batch_size,self.num_stacks,sigma=1,is_shuffle=True,rot_flag=True,scale_flag=True,flip_flag=True )
csvlogger = CSVLogger(
os.path.join(model_path,"csv_train_" + str(datetime.datetime.Now().strftime(''%H:%M'')) + ".csv"))
modelfile = os.path.join(model_path,''weights_{epoch:02d}_{loss:.2f}.hdf5'')
checkpoint = EvalCallBack(model_path,self.inres,self.outres)
xcallbacks = [csvlogger,checkpoint]
self.model.fit_generator(generator=train_gen,steps_per_epoch=train_dataset.get_dataset_size() // batch_size,epochs=epochs,callbacks=xcallbacks)
这是training
最后一行的错误:
self.model.fit_generator(generator=train_gen,callbacks=xcallbacks)
我在这里添加整个生成器部分:
def generator(self,num_hgstack,with_Meta=False,is_shuffle=False,rot_flag=False,scale_flag=False,flip_flag=False):
''''''
Input: batch_size * inres * Channel (3)
Output: batch_size * oures * nparts
''''''
train_input = np.zeros(shape=(batch_size,self.inres[0],self.inres[1],3),dtype=np.float)
gt_heatmap = np.zeros(shape=(batch_size,self.outres[0],self.outres[1],self.nparts),dtype=np.float)
Meta_info = list()
if not self.is_train:
assert (is_shuffle == False),''shuffle must be off in val model''
assert (rot_flag == False),''rot_flag must be off in val model''
while True:
if is_shuffle:
shuffle(self.anno)
for i,kpanno in enumerate(self.anno):
_imageaug,_gthtmap,_Meta = self.process_image(i,kpanno,sigma,rot_flag,scale_flag,flip_flag)
_index = i % batch_size
train_input[_index,:,:] = _imageaug
gt_heatmap[_index,:] = _gthtmap
Meta_info.append(_Meta)
if i % batch_size == (batch_size - 1):
out_hmaps = []
for m in range(num_hgstack):
out_hmaps.append(gt_heatmap)
if with_Meta:
yield train_input,out_hmaps,Meta_info
Meta_info = []
else:
yield train_input,out_hmaps
process.image
只包含很少的图像处理内容,例如调整大小、旋转...
File "train.py",line 56,in <module>
xnet.train(epochs=args.epochs,model_path=args.model_path,batch_size=args.batch_size)
File "C:/Users/srira/Desktop/hourglass_keras master/src/net\hourglass.py",line 54,in train
self.model.fit_generator(generator=train_gen,File "D:\Softwares\Anaconda\lib\site-packages\keras\engine\training.py",line 1918,in fit_generator
return self.fit(
File "D:\Softwares\Anaconda\lib\site-packages\keras\engine\training.py",line 1158,in fit
tmp_logs = self.train_function(iterator)
File "D:\Softwares\Anaconda\lib\site
packages\tensorflow\python\eager\def_function.py",line 889,in __call__
result = self._call(*args,**kwds)
File "D:\Softwares\Anaconda\lib\site packages\tensorflow\python\eager\def_function.py",line 950,in _call
return self._stateless_fn(*args,**kwds)
File "D:\Softwares\Anaconda\lib\site packages\tensorflow\python\eager\function.py",line 3023,in __call__
return graph_function._call_flat(
File "D:\Softwares\Anaconda\lib\site packages\tensorflow\python\eager\function.py",line 1960,in _call_flat
return self._build_call_outputs(self._inference_function.call(
File "D:\Softwares\Anaconda\lib\site packages\tensorflow\python\eager\function.py",line 591,in call
outputs = execute.execute(
File "D:\Softwares\Anaconda\lib\site packages\tensorflow\python\eager\execute.py",line 59,in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle,device_name,op_name,tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible
shapes: [6,64,1] vs. [1,6,64]
[[node gradient_tape/mean_squared_error/broadcastGradientArgs
(defined at D:\Softwares\Anaconda\lib\site-
packages\keras\engine\training.py:774) ]]
[Op:__inference_train_function_15421]
Function call stack:
train_function
2021-07-29 21:29:02.396214: W tensorflow/core/kernels/data/generator_dataset_op.cc:107] Error occurred when finalizing GeneratorDataset iterator:
失败的前提条件:Python 解释器状态未初始化。进程可能会终止。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
Error during WebSocket handshake: Unexpected response code: 200
Error during WebSocket handshake: Unexpected response code: 200
这是服务器配置:
@Configuration
@EnableWebMvc
@EnableWebSocket
@RequestMapping("/gpsConfig")
public class GpsWebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
@RequestMapping("/gpsTrigger")
public void messageTrigger(){
}
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(gpsWebSocketHandler(), "/gpsweb/warn").setAllowedOrigins("*").addInterceptors(gpsInterceptor());
}
@Bean
public GpsWarnWebSocketHandler gpsWebSocketHandler() {
return new GpsWarnWebSocketHandler();
}
@Bean
public GpsHandshakeInterceptor gpsInterceptor() {
return new GpsHandshakeInterceptor();
}
}
var webSocket =
new WebSocket(''ws://localhost:8080/hx-gps-platform/gpsweb/warn'');
关于【tensorFlow】tf.reshape()报错信息 - TypeError: Expected binary or unicode string和import tensorflow as tf报错的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于'TypeError at /api/chunked_upload/ Unicode-objects must be encoding before hashing' 在 Django 项目中使用 botocore 时出错、angular6.1.0 运行时报错 ERROR in node_modules/rxjs/internal/types.d.ts (81,44): error TS1005: '';'' expected.、AttributeError: 'tuple' 对象在 tensorflow 中没有属性 'shape' :-> y_t_rank = len(y_t.shape.as_list())、Error during WebSocket handshake: Unexpected response code: 200等相关知识的信息别忘了在本站进行查找喔。
本文标签: