ValueError:无法将大小为30470400的数组重塑为形状(50,1104,104) [英] ValueError: cannot reshape array of size 30470400 into shape (50,1104,104)
问题描述
我正在尝试运行此教程 http://emmanuelle .github.io/segmentation-of-3-d-tomography-images-with-python-and-scikit-image.html
I am trying to run threw this Tutorial http://emmanuelle.github.io/segmentation-of-3-d-tomography-images-with-python-and-scikit-image.html
我想用Python分割3D断层图像.
where I want to do a Segmentation of 3-D tomography images with Python.
我从一开始就在努力调整图像的形状.
I'm struggling directly in the beginning, with reshaping the image.
这是代码:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import time as time
data = np.fromfile('/data/data_l67/dalladas/Python3/Daten/Al8Cu_1000_g13_t4_200_250.vol', dtype=np.float32)
data.shape
(60940800,)
data.reshape((50,1104,104))
--------------------------------------------------- ---------------------------- ValueError追踪(最近的呼叫 最后)在() ----> 1个data.reshape((50,1104,104))
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) in () ----> 1 data.reshape((50,1104,104))
ValueError:无法将大小为30470400的数组重塑为形状 (50,1104,104)
ValueError: cannot reshape array of size 30470400 into shape (50,1104,104)
有人可以帮我吗?
推荐答案
似乎有错字,因为1104*1104*50=60940800
,而您正在尝试将尺寸调整为50,1104,104
.因此,您似乎需要将104更改为1104.
It seems that there is a typo, since 1104*1104*50=60940800
and you are trying to reshape to dimensions 50,1104,104
. So it seems that you need to change 104 to 1104.
这篇关于ValueError:无法将大小为30470400的数组重塑为形状(50,1104,104)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!