Spaces:
Runtime error
Runtime error
Upload transfer.py
Browse files- transfer.py +25 -0
transfer.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#import cv2
|
2 |
+
import numpy as np
|
3 |
+
# import matplotlib.pyplot as plt
|
4 |
+
#from local_utils import detect_lp
|
5 |
+
from os.path import splitext,basename
|
6 |
+
from keras.models import model_from_json
|
7 |
+
# import glob
|
8 |
+
|
9 |
+
|
10 |
+
def load_model(path):
|
11 |
+
try:
|
12 |
+
path = splitext(path)[0]
|
13 |
+
with open('%s.json' % path, 'r') as json_file:
|
14 |
+
model_json = json_file.read()
|
15 |
+
model = model_from_json(model_json, custom_objects={})
|
16 |
+
model.load_weights('%s.h5' % path)
|
17 |
+
#print("Loading model successfully...")
|
18 |
+
return model
|
19 |
+
except Exception as e:
|
20 |
+
print(e)
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
# wpod_net_path = "wpod-net.json"
|
25 |
+
# wpod_net = load_model(wpod_net_path)
|