Generate example data for a deep learning model

29 Views Asked by At

for a deep learning project, before running my model on all my data I want to test it on artificial data. So I tried to create some data but I have a dimension problem.

# Here, we create dummy data as an example
num_frames = 12
num_examples = 10000


input_court_array = np.random.rand(num_examples, num_frames, 8)
input_poses_array = np.random.rand(num_examples, num_frames, 48)
input_shuttle_array = np.random.rand(num_examples, num_frames, 2)
labels_array = np.random.randint(2, size=(num_examples,))

# Sliding window approach 
stride = 1

input_court_examples = []
input_poses_examples = []
input_shuttle_examples = []
labels_examples = []

for i in range(0, len(input_court_array) - num_frames + 1, stride):
    input_court_example = input_court_array[i:i+num_frames]
    input_poses_example = input_poses_array[i:i+num_frames]
    input_shuttle_example = input_shuttle_array[i:i+num_frames]
    labels_example = labels_array[i+num_frames-1]
    
    input_court_examples.append(input_court_example)
    input_poses_examples.append(input_poses_example)
    input_shuttle_examples.append(input_shuttle_example)
    labels_examples.append(labels_example)


input_court_examples = np.array(input_court_examples)
input_poses_examples = np.array(input_poses_examples)
input_shuttle_examples = np.array(input_shuttle_examples)
labels_examples = np.array(labels_examples)

print("Dimensions des données générées :")
print("input_court_examples :", input_court_examples.shape)
print("input_poses_examples :", input_poses_examples.shape)
print("input_shuttle_examples :", input_shuttle_examples.shape)
print("labels_examples :", labels_examples.shape)

I have the following output :

Dimensions des données générées :
input_court_examples : (9989, 12, 12, 8)
input_poses_examples : (9989, 12, 12, 48)
input_shuttle_examples : (9989, 12, 12, 2)
labels_examples : (9989,)

Whereas i would like to have :

Dimensions des données générées :
input_court_examples : (9989, 12, 8)
input_poses_examples : (9989, 12, 48)
input_shuttle_examples : (9989, 12, 2)
labels_examples : (9989,)

I tried to modifie my for loop like that :

for i in range(0, len(input_court_array) - num_frames + 1, stride):
input_court_example = input_court_array\[i:i+num_frames, :, :\]
input_poses_example = input_poses_array\[i:i+num_frames, :, :\]
input_shuttle_example = input_shuttle_array\[i:i+num_frames, :, :\]
labels_example = labels_array\[i:i+num_frames, :\]

    input_court_examples.append(input_court_example)
    input_poses_examples.append(input_poses_example)
    input_shuttle_examples.append(input_shuttle_example)
    labels_examples.append(labels_example)

But it didn't work

What may be the problem?

0

There are 0 best solutions below