KhomZ / Automatic-Number-Plate-Recognition-with-SMS-Alert

Automatic Nepali Number Plate Recognition with Sms Reporting System x Real Time Machine Learning Approach on Traffic Congestion Prediction System in Internet of Vehicles
MIT License
1 stars 0 forks source link

NameError: name 'model_from_json' is not defined #19

Closed KhomZ closed 2 years ago

KhomZ commented 2 years ago

NameError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_13688/1705145501.py in 3 loaded_model_json = json_file.read() 4 json_file.close() ----> 5 model = model_from_json(loaded_model_json) 6 model.load_weights("License_character_recognition_weight.h5") 7 print("[INFO] Model loaded successfully...")

NameError: name 'model_from_json' is not defined

KhomZ commented 2 years ago

from keras.models import model_from_json

Load model architecture, weight and labels

json_file = open('MobileNets_character_recognition.json', 'r') loaded_model_json = json_file.read() json_file.close() model = model_from_json(loaded_model_json) model.load_weights("../Automatic-License-Plate-Detection-khom/character_recognition/License_character_recognition.h5") print("[INFO] Model loaded successfully...")

labels = LabelEncoder() labels.classes_ = np.load('../Automatic-License-Plate-Detection-khom/character_recognition/license_character_classes.npy') print("[INFO] Labels loaded successfully...")