IndexError: too many indices error when running bootstrap.py
phongnhhn92 opened this issue · 8 comments
I have this error at line
move_files('train', labels[idx_test, :])
Index Error: too many indices
Any solution for this ? Thanks !
Strange error. I didn't get it. Try again from scratch (by deleting the data dir), as I did some improvements in the code (don't forget to git pull before).
I get the same error - was this sorted out?
switching from python3.5 to python2.7 solved this problem for me
Alternatively, if I have a cats and dogs data set with the following data structure:
data/
train/
dogs/
dog001.jpg
dog002.jpg
...
cats/
cat001.jpg
cat002.jpg
...
validation/
dogs/
dog001.jpg
dog002.jpg
...
cats/
cat001.jpg
cat002.jpg
How can I change the code to get this data to work?
I have the following data structure cats (120, class=0) and dogs (120, class=1):
data/sorted/test/0
data/sorted/test/1
data/sorted/train/0
data/sorted/train/1
data/sorted/valid/0
data/sorted/valid/1
The bottleneck routine runs and stores the .npy files OK. I get an error message when running the train_top_model() and I have been through debugging got correct train and validation numbers and cannot see why I'm getting this error. Please help.
Error message says more training samples (7,200) than target labels (240)?? where 7200 comes from I have no idea?
In python 3.6, the zip
function returns a Zip object which returns elements on it's __next__()
method (I haven't looked up the behaviour in earlier versions).
I resolved this in 3.6 with a simple list comprehension:
labels = np.array([i for i in zip(files, image_labels)])