emotion-recognition-neural-networks
emotion-recognition-neural-networks copied to clipboard
Conversion error
Im getting the following error while conversion
File "cvs_to_numpy.py", line 71, in <module>
image = data_to_image(row['pixels'])
File "cvs_to_numpy.py", line 59, in data_to_image
data_image = format_image(data_image)
File "cvs_to_numpy.py", line 16, in format_image
gray_border[((150 / 2) - (SIZE_FACE/2)):((150/2)+(SIZE_FACE/2)), ((150/2)-(SIZE_FACE/2)):((150/2)+(SIZE_FACE/2))] = image
TypeError: slice indices must be integers or None or have an __index__ method
you need to give integers to reach indices of gray_border. use a int(float f) to make sure you get it right.
@AdrienPlayerium i didn't get it. can you tell how to solve this problem?
@Mrinal18 In this code sample, he got a numpy array which contains pixel information, to pick the region of interest you got to pick a part of this matrix, that's what he tried above. It's almost correct, the error is raised because the slices: ((150 / 2) - (SIZE_FACE/2)):((150/2)+(SIZE_FACE/2)):((150/2)-(SIZE_FACE/2)):((150/2)+(SIZE_FACE/2)) "select square of SIZE_FACE around (150/2,150/2) position" is not well defined since the type of those numbers are floats... therefore a quick fix would be to cast to integers: int((150 / 2) - (SIZE_FACE/2)):int((150/2)+(SIZE_FACE/2)):int((150/2)-(SIZE_FACE/2)):int((150/2)+(SIZE_FACE/2))
Got it. Thank you very much.