I have a set of data which I want to feed into a convolutional neural network to produce an output.
# ## Some Constants and Variables
phases = ['Phase A','Phase B', 'Phase C']
sides = ['Primary', 'Secondary']
sections = ['sec_1', 'sec_2','sec_3']
triggerTimes = [0.2]
folders = ['input_current', 'output_current']
powers = list(np.arange(10000,220000,10000))
#I have a data in different folders, so I combine the prefix to get the different folders
PREFIX = "C:\\Users\\Edwin\\Desktop\\PROJECT\\AI\\Data\\"
H_PREFIX = PREFIX + 'Healthy\\Scalogram\\'
F_PREFIX = PREFIX + 'Faulty\\Scalogram\\'
START = 0.01
STEP = 0.01
BATCH =99
BN = 1
percentShorts = [round(f, 2) for f in list(np.arange(START, START + STEP*BATCH, STEP))]
HEALTHY_COUNT = 21
FAULTY_COUNT = len(phases)*len(sides)*BATCH*len(sections)*len(triggerTimes)
data = [] # Store images concatenated along the channel axis
healthLabels = [] # Indicate presence of fault or otherwise: ['Healthy', 'Faulty']
phaseLabels = [] # Store phase labels for faults: ['Phase A', 'Phase B', 'Phase C', 'None']
sideLabels = [] # Store side labels for faults: ['Primary', 'Secondary', 'None']
percentLabels = [] # Store percentage short labels for faults: [percentShort, 0]
# Healthy Images
'''for power in powers:
# List to hold horizontally-concatenated images for v-concat
images = []
for folder in folders:
# Loop over the image, read and append them to the list of images
newpath = H_PREFIX + '\\' + str(power) + '\\'+ folder
print(newpath)
for imagePath in sorted(list(paths.list_images(newpath))):
images.append(cv.cvtColor(cv.imread(imagePath), cv.COLOR_BGR2RGB))
# Add image to data array
data.append(np.concatenate(tuple(images), axis=-1))
# Add the labels
healthLabels.append('Healthy')
phaseLabels.append('None')
sideLabels.append('None')
percentLabels.append('0')'''
assert data[0].shape == (256, 256, 18) # Ensure final image size
print(len(data))
print("Healthy images=", len(data))
assert len(data) == HEALTHY_COUNT
assert len(healthLabels) == HEALTHY_COUNT # Ensure number of healthy images
print("new healthy images", len(data))
#this is followed by the same code for the faulty folders (F_Prefix), then I save the file of both healthy and faulty images
# Save data and labels as npz files
np.savez_compressed('dataset/finaldataset0.06faulty.npz', data=data, healthLabels=healthLabels, phaseLabels=phaseLabels, sideLabels=sideLabels, percentLabels=percentLabels)
A friend of mine generated a similar dataset using the same information, however when I run my dataset to the network, it gets classification errors. Yet when I run his through the network, it works perfectly. Am I doing something wrong? He's MIA unfortunately, so I can't reach him. I could upload the code files to a google drive in case anyone needs more information to understand the work.