У меня проблема с моим кодом ValueError: массив нулевого размера до максимума операции сокращения, который не имеет идентичности - PullRequest
0 голосов
/ 21 марта 2020

это мой код:

pics, labels = [], [] #ukuran gambar
i=0
for dir_path in glob.glob("/content/drive/My Drive/chest/*"):             #baca semua yang ada di folder chest_xray
    for pic in glob.glob(os.path.join(dir_path,"*.jpeg")):                #baca file yang berekstensi jpg
        temp = cv2.imread(pic)                                            #baca dengan computer vision2
        temp = cv2.resize(temp, (64,64))                                  #ukuran gambar
        pics.append(temp)                                                 #memasukan ke pictures
        labels.append(i)                                                  #mengasign ke labels
    i=i+1 
X = np.array(pics)
y = np.array(labels)

dummy_y = np_utils.to_categorical(y)
print(X.shape)

и это массаж ошибок:

ValueError                                Traceback (most recent call last)

<ipython-input-6-6c1301713864> in <module>()
     11 y = np.array(labels)
     12 
---> 13 dummy_y = np_utils.to_categorical(y)
     14 print(X.shape)
     15 

2 frames

<__array_function__ internals> in amax(*args, **kwargs)

/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
     88                 return reduction(axis=axis, out=out, **passkwargs)
     89 
---> 90     return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
     91 
     92 

ValueError: zero-size array to reduction operation maximum which has no identity
...