SCUT-FBP5500-Database-Release
SCUT-FBP5500-Database-Release copied to clipboard
TypeError: slice indices must be integers or None or have an __index__ method
Traceback (most recent call last):
File "forward.py", line 134, in
Do you change any argments in "forward.py"? It runs well on my computer.
I didnot make any code change. Clone new caffe code with windows version and make install. And run forward.py just it
may be the python version differences. You can change the code like this: mean_npy = mean_npy[ :, int((_shape[2] - crop_size[0]) / 2) : int((_shape[2] + crop_size[0]) / 2), int((_shape[3] - crop_size[1]) / 2) : int((_shape[3] + crop_size[1]) / 2)]
I did this.
Pytorch version has issue.
Anaconda: 3-4.1.1 torch : 1.1.0
Traceback (most recent call last):
File "forward.py", line 86, in
For pytorch issue(on Python 3.5.2)
Add:
from functools import partial import pickle pickle.load = partial(pickle.load, encoding="latin1") pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")
And make change: # load pretrained model load_model(torch.load('./models/alexnet.pth',pickle_module=pickle), net)
I encountered this error as well. At some point in the index there is a "divide by 2" and Python would possibly treat it as float number after dividing by 2. Using integer casting int() should solve the problem.
Mine works well in the caffe version. Not fully sure about Pytorch version.