我最近看到了一个有关“线性回归”的例子
他在用numpy按dtype = numpy.float64
x = numpy.array([1,2,3,4] , dtype = numpy.float64)
我尝试了不使用flaot64的情况,在flaot64中它返回不同的值而不是错误
为什么?
答案 0 :(得分:1)
要使用哪种数据类型取决于用例。
Traceback (most recent call last):
File "<ipython-input-5-e5959b6300f2>", line 1, in <module>
runfile('D:/Mask R-CNN/test.py', wdir='D:/Mask R-CNN')
File "D:\Anaconda3\Anaconda3-5.3.0\envs\cv2\lib\site-
packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
execfile(filename, namespace)
File "D:\Anaconda3\Anaconda3-5.3.0\envs\cv2\lib\site-
packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/Mask R-CNN/test.py", line 49, in <module>
model.load_weights(COCO_MODEL_PATH, by_name=True, exclude=[
"mrcnn_class_logits", "mrcnn_bbox_fc"])
File "D:\Mask R-CNN\mrcnn\model.py", line 2131, in load_weights
saving.load_weights_from_hdf5_group_by_name(f, layers)
File "D:\Anaconda3\Anaconda3-5.3.0\envs\cv2\lib\site-
packages\keras\engine\saving.py", line 1104, in
load_weights_from_hdf5_group_by_name
g = f[name]
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "D:\Anaconda3\Anaconda3-5.3.0\envs\cv2\lib\site-
packages\h5py\_hl\group.py", line 177, in __getitem__
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5o.pyx", line 190, in h5py.h5o.open
KeyError: 'Unable to open object (wrong B-tree signature)'
此处数组的元素类型为float64(双精度浮点数)。
x = numpy.array([1,2,3,4] , dtype = numpy.float64)
此处元素的类型为int64(整数)