I'm making an ai using image recognition, so I recorded each frames of me playing into a numpy array. It worked just fine when the first time I exported all the images and got the 6 thousand of them. Now, I was recording a lot more data but suddently I get this erro with no change in my code or environement

Traceback (most recent call last):

File "D:\Dev\Fall-Guys-AI-Race\utils\CreateImages.py", line 6, in > data = np.load("D:/Dev/Fall-Guys-AI-Race/data/training_data.npy", allow_pickle=True)

File "D:\Program Files\Python39\lib\site-packages\numpy\lib\npyio.py", line 430, in load > return format.read_array(fid, allow_pickle=allow_pickle,

File "D:\Program Files\Python39\lib\site-packages\numpy\lib\format.py", line 786, in read_array > array.shape = shape

ValueError: cannot reshape array of size 2147483648 into shape (14460,224,224,3)

Here is my CreateImages.py :

import cv2, os
import numpy as np

listing = os.listdir("D:/Dev/Fall-Guys-AI-Race/data/")
for j in range(1):
    data = np.load("D:/Dev/Fall-Guys-AI-Race/data/training_data.npy", allow_pickle=True)
    targets = np.load("D:/Dev/Fall-Guys-AI-Race/data/target_data.npy", allow_pickle=True)

    print(f'Image Data Shape: {data.shape}')
    print(f'targets Shape: {targets.shape}')

    # Lets see how many of each type of move we have.
    unique_elements, counts = np.unique(targets, return_counts=True)

    # Store both data and targets in a list.
    # We may want to shuffle down the road.

    holder_list = []
    for i, image in enumerate(data):
        holder_list.append([data[i], targets[i]])

    count_up = 0
    count_left = 0
    count_right = 0
    count_jump = 0
    count_down = 0

    for data in holder_list:
        #writes data to image in correct folder, skipped because lots of lines:
        cv2.imwrite(f"*my_path*{count_left}.png", data[0])
    print(count_down, count_up, count_jump, count_left, count_right)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.