Skip to content

load data error #2

@cherishtttz

Description

@cherishtttz

hello Sir, thanks for providing such a complete project. But there are 2 questions for my running, the first one is that when you load the training data, if you just use
def load_data(): path = '/home/tz/data_analysis/cat-vs-dog/train/' files = os.listdir(path) images = [] labels = [] for f in files: img_path= path + f img = pil_image.open(img_path) img = img.resize((128, 128)) img_array = np.asarray(img)/255 images.append(img_array)
actually you can't read any image just use path "/home/tz/data_analysis/cat-vs-dog/train/cat", you should add the complete path such as "/home/tz/data_analysis/cat-vs-dog/train/cat.1.jpg";
the second question is the function ' train_test_split()', when I use your code, I found an error "ValueError: Found input variables with inconsistent numbers of samples: [25000, 2]", I can't find a solution, could you please give me a hand? thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions