|
Algorithm 2 CNN Feature Extraction Using ResNet-18’s 35th/68th Layer |
-
1:
procedure CNNFeatureExtraction
-
2:
Initialize root folders for each dataset ▹ for 5 drills
-
3:
Define categories: Green, Yellow, Red ▹ for three subfolders
-
4:
Create imageDatastore instances for each dataset
-
5:
Combine datasets for training and testing
-
6:
Load pretrained ResNet-18 model
-
7:
Define feature extraction layer (e.g., 68th layer or 35th layer)
-
8:
for each combined dataset (1 through 5) do
-
9:
Read image
-
10:
Preprocess image according to CNN input requirements
-
11:
Extract features using the specified CNN layer
-
12:
Store extracted features
-
13:
end for
-
14:
Output the set of extracted features
-
15:
end procedure
|