CNN code for classification of three classes of image

I am new to CNN and trying to train the images and then test them and then classify the type of image. I am using python and PYQT designer for GUI. My task is to perform classification on three types of Brain Tumor MRI images. All the images are assigned labels.
My GUI is stated as follows:

  1. Load Data (complete dataset) for training by a button named as “Load”.
  2. Automatically split the dataset into Testing and Training by a button named as “split”.
  3. Train the dataset by a button named as “Training”.
  4. Test the image by a button “Testing”.
  5. The result displays the image with its label.

Any help in this regard will be appreciated. Thank you.

The splitting of the workload into these steps sounds reasonable.
Where are you stuck exactly and what have you already implemented?

1 Like

I am stuck in testing and training split part, although i’m following standard format of piece of code used for splitting.

Could you post your code snippet showing how you are splitting and what is currently not working?

1 Like

There is a problem in file reading or data loading. Could you please help me that how can I load my custom dataset for classification?

This tutorial gives you a good overview on how to create a custom Dataset. If you get stuck, please post some code so that we could have a look at it. :slight_smile:

1 Like

I have my dataset of 3000 images. I want to load them and then split them into testing and training ratio.

You could either use torch.utils.data.random_split and provide the lengths you would like to use for the random splitting or alternatively, if you want to use a stratified split, you could use sklearn's train_test_split as seen here.

1 Like