Posts

Showing posts with the label conv-neural-network

How do I load custom image based datasets into Pytorch for use with a CNN?

Image
Clash Royale CLAN TAG #URR8PPP How do I load custom image based datasets into Pytorch for use with a CNN? I have searched for hours on the internet to find a good solution to my issue. Here is some relevant background information to help you answer my question. This is my first ever deep learning project and I have no idea what I am doing. I know the theory but not the practical elements. The data that I am using can be found on kaggle at this link: (https://www.kaggle.com/alxmamaev/flowers-recognition) I am aiming to classify flowers based on the images provided in the dataset using a CNN. Here is some sample code I have tried to use to load data in so far, this is my best attempt but as I mentioned I am clueless and Pytorch docs didn't offer much help that I could understand at my level. (https://pastebin.com/fNLVW1UW) # Loads the images for use with the CNN. def load_images(image_size=32, batch_size=64, root="../images"): transform = transforms.Compose([ ...

Finetuning ResNet50 with keras - val_loss keeps increasing

Image
Clash Royale CLAN TAG #URR8PPP Finetuning ResNet50 with keras - val_loss keeps increasing I am trying to customize resnet50 using keras with a tensorflow backend. However, upon tranining my val_loss keeps increasing. Trying different learning rates and batch sizes does not resolve the problem. Using different preprocessing methods such as rescaling or using the preprocess_input function for resnet50 inside the ImageDataGenerator did not not solve the problem either. This is the code I am using Importing and preprocessing data: from keras.preprocessing.image import ImageDataGenerator from keras.applications.resnet50 import preprocess_input, decode_predictions IMAGE_SIZE = 224 BATCH_SIZE = 32 num_classes = 27 main_path = "C:/Users/aaron/Desktop/DATEN/data" gesamt_path = os.path.join(main_path, "ML_DATA") labels = listdir(gesamt_path) data_generator = ImageDataGenerator(#rescale=1./255, validation_split=0.20, ...

What is the default stride length in Keras' Conv1D?

Image
Clash Royale CLAN TAG #URR8PPP What is the default stride length in Keras' Conv1D? Currently, I am tuning my model by testing the Kernel size. I have the following code : code x = embedding_layer(input_4) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = MaxPooling1D(3)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, activation='relu')(x) x = Dropout(DROPOUT)(x) x = Conv1D(FILTERS, KERNEL, ...