Was meint float() argument must be a string or a number, not 'type'
Verfasst: Donnerstag 8. August 2019, 20:42
Hallo, ich versuche schon seit längerer Zeit Bilder in Arrays zu laden, um diese weiterzunutzen.
Ich nahm dieses script um die Bilder zu Arrays zu machen.
i = 0
while i < len_path_parrot:
img = load_img("picturesready\\parrot\\" + path_parrot)
Z = img_to_array(img, dtype = float)
Z.flatten("F")
Z.astype(float)
X = numpy.append(X, Z)
y = numpy.append(y, 1)
i = i + 1
Das geht sehr gut. Der Inhalt dieser Arrays ist folgender:
array([<class 'float'>, 66.0, 98.0, ..., 244.0, 254.0, 255.0], dtype=object)
Aber bei dieser Zeile kommt ein Fehler.
X = X.astype(float)
Der Fehler lautet: float() argument must be a string or a number, not 'type'
Was meint dieser Fehler, und was kann ich machen, damit ich das Programm nutzen kann?
Ich nahm dieses script um die Bilder zu Arrays zu machen.
i = 0
while i < len_path_parrot:
img = load_img("picturesready\\parrot\\" + path_parrot)
Z = img_to_array(img, dtype = float)
Z.flatten("F")
Z.astype(float)
X = numpy.append(X, Z)
y = numpy.append(y, 1)
i = i + 1
Das geht sehr gut. Der Inhalt dieser Arrays ist folgender:
array([<class 'float'>, 66.0, 98.0, ..., 244.0, 254.0, 255.0], dtype=object)
Aber bei dieser Zeile kommt ein Fehler.
X = X.astype(float)
Der Fehler lautet: float() argument must be a string or a number, not 'type'
Was meint dieser Fehler, und was kann ich machen, damit ich das Programm nutzen kann?