Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
part_of_F3_OCR
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
162457e4
authored
2022-09-07 17:18:27 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update model
1 parent
a379fac9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
classification/model.py
classification/model.py
View file @
162457e
...
...
@@ -107,7 +107,7 @@ class F3Classification(BaseModel):
image
=
applications
.
mobilenet_v2
.
preprocess_input
(
image
)
return
image
,
label
def
load_dataset
(
self
,
dataset_dir
,
name
,
batch_size
=
128
,
augmentation_methods
=
[]):
def
load_dataset
(
self
,
dataset_dir
,
name
,
batch_size
=
128
,
augmentation_methods
=
[]
,
drop_remainder
=
True
):
image_and_label_list
=
self
.
get_image_label_list
(
dataset_dir
)
tensor_slice_dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
(
image_and_label_list
,
name
=
name
)
dataset
=
tensor_slice_dataset
.
shuffle
(
len
(
image_and_label_list
[
0
]),
reshuffle_each_iteration
=
True
)
...
...
@@ -122,7 +122,7 @@ class F3Classification(BaseModel):
self
.
preprocess_input
,
num_parallel_calls
=
tf
.
data
.
AUTOTUNE
,
deterministic
=
False
)
parallel_batch_dataset
=
dataset
.
batch
(
batch_size
=
batch_size
,
drop_remainder
=
True
,
drop_remainder
=
drop_remainder
,
num_parallel_calls
=
tf
.
data
.
AUTOTUNE
,
deterministic
=
False
,
name
=
name
,
...
...
@@ -144,7 +144,8 @@ class F3Classification(BaseModel):
)
x
=
base_model
.
output
x
=
layers
.
Dropout
(
0.5
)(
x
)
x
=
layers
.
Dense
(
256
,
activation
=
'sigmoid'
,
name
=
'dense'
)(
x
)
# x = layers.Dense(256, activation='sigmoid', name='dense')(x)
x
=
layers
.
Dense
(
256
,
activation
=
'relu'
,
name
=
'dense'
)(
x
)
x
=
layers
.
Dropout
(
0.5
)(
x
)
x
=
layers
.
Dense
(
self
.
class_count
,
activation
=
'sigmoid'
,
name
=
'output'
)(
x
)
self
.
model
=
models
.
Model
(
inputs
=
base_model
.
input
,
outputs
=
x
)
...
...
@@ -243,7 +244,8 @@ class F3Classification(BaseModel):
batch_size
=
batch_size
,
augmentation_methods
=
[
'rgb_2_bgr'
]
],
drop_remainder
=
False
,
)
label_true_list
=
[]
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment