-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureExtraction.R
More file actions
32 lines (26 loc) · 1.22 KB
/
FeatureExtraction.R
File metadata and controls
32 lines (26 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Clear the environment
rm(list = ls())
# Load necessary libraries
library(keras)
library(tensorflow)
library(Metrics)
library(pROC)
library(tidyverse)
#---------------------------------------------------------------------------------------
## Feature Extraction ##
# Set the path to the dataset
path_to_data <- '' # Replace with the actual path
# Load and preprocess train and test data
train_data_generator <- image_data_generator(rescale = 1/255)
test_data_generator <- image_data_generator(rescale = 1/255)
train_data <- flow_images_from_directory(file.path(path_to_data, "training_set"),
generator = train_data_generator,
target_size = c(32, 32),
batch_size = 32,
class_mode = 'binary')
test_data <- flow_images_from_directory(file.path(path_to_data, "test_set"),
generator = test_data_generator,
target_size = c(32, 32),
batch_size = 32,
class_mode = 'binary',
shuffle = FALSE)