python - TypeError:在运行 caffe 示例期间需要一个类似字节的对象,而不是 python3 中的“str”
问题描述
当我运行这些代码时:
untrained_style_net = caffe.Net(style_net(train=False, subset='train'),'/content/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel', caffe.TEST)
untrained_style_net.forward()
style_data_batch = untrained_style_net.blobs['data'].data.copy()
style_label_batch = np.array(untrained_style_net.blobs['label'].data, dtype=np.int32)
我收到此错误:
TypeError Traceback (most recent call last)
in ()
----> 1 untrained_style_net = caffe.Net(style_net(train=False, subset='train'),'/content/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel', caffe.TEST)
2 untrained_style_net.forward()
3 style_data_batch = untrained_style_net.blobs['data'].data.copy()
4 style_label_batch = np.array(untrained_style_net.blobs['label'].data, dtype=np.int32)
2 frames
/usr/lib/python3.6/tempfile.py in func_wrapper(*args, **kwargs)
622 @_functools.wraps(func)
623 def func_wrapper(*args, **kwargs):
--> 624 return func(*args, **kwargs)
625 # Avoid closing the file as long as the wrapper is alive,
626 # see issue #18879.
TypeError: a bytes-like object is required, not 'str'
我该如何解决?
解决方案
推荐阅读
- c# - EF Core:在没有导航属性的情况下映射多对多关系
- java - 如何让 Launch4j XML 配置正确捆绑 JRE?
- javascript - 如何在不保存对数组的引用的情况下创建具有一些数组值的对象?
- python - 有没有办法将 EEG 电极绘制到小鼠大脑模型上?
- python - 多类标签交叉验证的 F1 分数
- c - 如何在另一个结构中使用结构的功能?
- node.js - TypeError: res.status is not a function expess app
- apache-spark - Spark Kubernetes 错误:Pod 已经存在
- python - 多帧 tkinter 的 KeyError?
- matlab - 在 Matlab 中重塑矩阵时的新坐标