Skip to main content
. 2023 Jun 6;15(12):3075. doi: 10.3390/cancers15123075
Steps: Feature Extraction from Input Images Using the VGG16 Model.
Input: BreakHis 400× training image data
Preprocessing: Resizing the images to 512 × 512
Normalizing pixel values to between 0 and 1
Output: Initialize the VGG16 model.
Import VGG16 model
Remove the fully connected layers.
Load the VGG16 model for feature extraction by removing the FC layers as they were designed for ImageNet classification tasks.
VGG_model = VGG16 (weights = ’Imagenet’, include_top = False,
input_shape = (512, 512, 3)
3-is the RGB channel since we are using color images
Pass the input images through the model:
Forward pass the preprocessed images through the VGG16 model to obtain the output feature maps.
Retrieve the output of the last convolutional layer as they capture the high-level abstract features.
Flatten the features.
Flatten(img): Convert the 3-D extracted features to the 1-D feature vector
Store the extracted features with corresponding image labels for classification tasks
Features(img) = Flatten(img)