perseus784 / BvS

An Image classifier to identify whether the given image is Batman or Superman using a CNN with high accuracy. (From getting images from google to saving our trained model for reuse.)

Home Page:https://medium.com/@ipaar3/how-i-built-a-convolutional-image-classifier-using-tensorflow-from-scratch-f852c34e1c95

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

choice_count index out of range

opened this issue · comments

When I run 'trainer.py', I get an error in 'def batch_dispatch' at 'choice_count = self.count_buffer[choice_index]':

File "C:\Users\Garrett\PycharmProjects\basic image recognition\utils.py", line 30, in batch_dispatch
choice_count = self.count_buffer[choice_index]
IndexError: list index out of range

In the 'init' function, it seems that 'count.buffer[]' is just being appended to, the number of (or length of) images in my data folder in which I am running my trainer on. I am just trying to run a very small number of images to make sure that the program runs at first. This means that for my 11 images in the data folder, 'count.buffer' just ends up equaling '[11]'. In batch_dispatch, I am getting a random index from the array of my 11 images, but when this random index, 'choice_index', is run into count.buffer it calls for an index way out of range. Since len(count_buffer) only equals 1 for me, getting a random image that is past the starting position, choice_index>0, will give me an error every time.

I'm sorry I am fairly new to coding. I would just greatly appreciate if you could help me through this error.

Thank you,

Garrett

I'll look into it by this weekend. Sorry.

No problem at all I just wanted to make sure I was reaching you and thank you very much.

The problem is in the config.py file, line number 11.
os.listdir(datapath) should give all classes that are present in the folder but it is not getting it.
So, the config file cannot find where you put your data.4
Go to the config file and edit with the data_path with where you put the data and also see the folder structure picture given in the post for clarity.

Thanks, I restructured my files and got my program to run farther through, so that fixed it. I’m just having a problem now since I ran into a Value error in a non-project file. I just don’t understand where this error is coming from.