-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
54 lines (54 loc) · 1.39 KB
/
.Rhistory
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# packages
library(tidyverse)
library(tensorflow)
library(keras3)
tensorflow::set_random_seed(197)
# the data has already been partitioned
batch_size <- 32
img_height <- 256
img_width <- 256
train_tumor <- image_dataset_from_directory(
directory = 'data/Training',
image_size = c(img_height, img_width),
batch_size = batch_size,
seed = 197
)
test_tumor <- image_dataset_from_directory(
directory = 'data/Testing',
image_size = c(img_height, img_width),
batch_size = batch_size,
seed = 197
)
# Single Layer Model
model_single_layer <- keras_model_sequential(input_shape = c(img_height, img_width, 3)) %>%
layer_rescaling(1./255) %>%
layer_flatten() %>%
layer_dense(4) %>%
layer_activation(activation = 'softmax')
# packages
library(tidyverse)
library(tensorflow)
library(keras3)
tensorflow::set_random_seed(197)
# the data has already been partitioned
batch_size <- 32
img_height <- 256
img_width <- 256
train_tumor <- image_dataset_from_directory(
directory = 'data/Training',
image_size = c(img_height, img_width),
batch_size = batch_size,
seed = 197
)
test_tumor <- image_dataset_from_directory(
directory = 'data/Testing',
image_size = c(img_height, img_width),
batch_size = batch_size,
seed = 197
)
# Single Layer Model
model_single_layer <- keras_model_sequential(input_shape = c(img_height, img_width, 3)) %>%
layer_rescaling(1./255) %>%
layer_flatten() %>%
layer_dense(4) %>%
layer_activation(activation = 'softmax')