[3:40 pm, 15/9/2024] Adit Shah VIT: ### 1. *Basic Setup*:
   - *Libraries Imported*:
     - numpy: 
     - pandas: 
     - os: 
   
   - *FastAI Setup*:
     - pip install -Uqq fastbook: 
     - fastbook.setup_book():

### 3. *Defining the DataBlock*:
   python
   cancer = DataBlock(
       blocks=(ImageBlock, CategoryBlock), 
       get_items=get_image_files,
       get_y=parent_label,
       item_tfms=Resize(128))
   
   - *DataBlock*:
     - FastAI uses the DataBlock API to simplify data processing and loading. This structure defines the pipeline for transforming raw data into inputs suitable for model training.
   
   - *Components*:
     - blocks=(ImageBlock, CategoryBlock): This defines the type of data being used. ImageBlock indicates that the inputs are images, and CategoryBlock indicates that the labels are categorical (e.g., types of brain tumors).
     - get_items=get_image_files: This function retrieves all image files from the dataset directory.
     - get_y=parent_label: This function extracts the label for each image, assuming the images are organized in directories by class (i.e., the parent directory name is the label).
     - item_tfms=Resize(128): This transformation resizes each image to 128x128 pixels to ensure consistency and reduce computational load. This step is important because neural networks require fixed-size inputs.

### 4. *Loading the Data*:
   python
   dls = cancer.dataloaders('/kaggle/input')
   
   - dataloaders: This method is used to create DataLoader objects that handle the loading and batching of data during training.
   - The argument '/kaggle/input' points to the directory where the dataset is stored. The DataLoader loads the images from this directory and prepares them for training and validation.


### Additional Sections to Look for:
   - *Model Definition*: There might be sections further down that define the neural network architecture used for classification, potentially using a pre-trained model from FastAI’s model zoo.
   - *Training Loop*: There is likely a section where the model is trained, which would involve splitting the data into training and validation sets, setting up a learning rate, and optimizing the model using gradient descent.
   - *Evaluation*: After training, the notebook may include cells for evaluating the model's performance, displaying accuracy, and generating classification reports or confusion matrices.

3. *Prediction and Inference*:
   - This section would demonstrate how to make predictions using the trained model on new data.
   - Visualizations (e.g., displaying images with predicted labels) could be included, potentially using widgets from FastAI.

4. *Saving and Exporting the Model*:
   - There might be code to save the trained model, which could involve exporting it to a file format that can be reloaded later (e.g., .pkl).
   - This is useful for deployment or further experimentation.

cancer = cancer.new(item_tfms=Resize(128, ResizeMethod.Squish))
dls.valid.show_batch(max_n=4, nrows=1)
cancer = cancer.new(item_tfms=Resize(128, ResizeMethod.Pad, pad_mode='zeros'))
dls.valid.show_batch(max_n=4, nrows=1)
cancer = cancer.new(item_tfms=RandomResizedCrop(128, min_scale=0.3))
dls.train.show_batch(max_n=4, nrows=1, unique=True)
cancer = cancer.new(item_tfms=Resize(128), batch_tfms=aug_transforms(mult=2))
dls.train.show_batch(max_n=8, nrows=2, unique=True)
cancer = cancer.new(
    item_tfms=RandomResizedCrop(224, min_scale=0.5),
    batch_tfms=aug_transforms())
dls.train = cancer.dataloaders('/kaggle/input/brain-tumor-classification-mri/Training')

learn = cnn_learner(dls.train, resnet18, metrics=error_rate)
learn.fine_tune(4)
epoch	train_loss	valid_loss	error_rate	time
0	1.408995	0.952663	0.343206	03:46
epoch	train_loss	valid_loss	error_rate	time
0	0.727643	0.613087	0.212544	05:08
1	0.564585	0.431153	0.116725	05:06
2	0.427994	0.360565	0.113240	05:02
3	0.322910	0.365968	0.111498	05:06

based on this notebook write an abstract for a research paper for this brain tumor classification model using mri scans that involves cnn and fastai