-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.py
More file actions
34 lines (25 loc) · 996 Bytes
/
train.py
File metadata and controls
34 lines (25 loc) · 996 Bytes
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
import keras
import tensorflow as tf
import numpy as np
import pandas as pd
import csv
class Train:
@staticmethod
def fine_tune():
# Loading the model
model = keras.models.load_model("OCR CNN.h5")
# Loading the original and the feedback CSV files
# df = pd.read_csv("combined_ocr_dataset.csv")
# new_df = pd.read_csv("feedback.csv")
# Appending the new data with the original dataset
# df = pd.concat([df, new_df])
# Freezing the layers
for layer in model.layers[:3]:
layer.trainable = False
print(f"Layer {layer.name} in use: {layer.trainable}")
print("============================================================================")
for layer in model.layers:
print(f"Layer {layer.name}: Trainable = {layer.trainable}")
# Loading the model
print(model.summary())
Train().fine_tune()