python - Memory error while converting list to numpy array -
python - Memory error while converting list to numpy array -
i've got total of around 7000 images i'm extracted pig features. want convert list np array farther processing. memory error during convertion.
here's relevant part of code:
from skimage import data, io, filter, color, exposure skimage.feature import pig skimage.transform import resize import matplotlib.pyplot plt import numpy np tmp_hogs = [] # list need convert numpy array grouping in samplegroups: myimg in group: curr_img = np.array(myimg, dtype=float) imgs.append(curr_img) fd, hog_image = hog(curr_img, orientations=8, pixels_per_cell=(4, 4), cells_per_block=(1, 1), visualise=true, normalise=true) tmp_hogs.append(fd) img_hogs = np.array(tmp_hogs, dtype =float)
the error is:
exception in thread thread-1: traceback (most recent phone call last): file "c:\users\app\anacondasoftware\lib\threading.py", line 810, in __bootstrap_inner self.run() file "c:\users\app\anacondasoftware\lib\site-packages\spyderlib\widgets\externalshell\monitor.py", line 582, in run already_pickled=true) file "c:\users\app\anacondasoftware\lib\site-packages\spyderlib\utils\bsdsocket.py", line 45, in write_packet nsend -= temp_fail_retry(socket.error, sock.send, sent_data) file "c:\users\app\anacondasoftware\lib\site-packages\spyderlib\utils\bsdsocket.py", line 25, in temp_fail_retry homecoming fun(*args) error: [errno 10054] existing connection forcibly closed remote host traceback (most recent phone call last): file "c:\users\app\documents\python scripts\gbc_carclassify.py", line 63, in <module> img_hogs = np.array(tmp_hogs, dtype =float) memoryerror
how can prepare it?
for rgb or rgba images need 8 bits per value, , when using float
alocating 64 bits per value. seek using np.uint8
instead:
img_hogs = np.array(tmp_hogs, dtype=np.uint8)
python arrays memory numpy
Comments
Post a Comment