The main.py is using the imagenet weights instead if the new trained model weights. In the function, upload file is not importing the model with the updated weights.
Look at the model being used -
model= ResNet50(weights='imagenet')
@app.route('/uploaded', methods = ['GET', 'POST']) def upload_file(): if request.method == 'POST': f = request.files['file'] path = os.path.join(app.config['UPLOAD_FOLDER'], f.filename) model= ResNet50(weights='imagenet') img = image.load_img(path, target_size=(224,224)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) preds_decoded = decode_predictions(preds, top=3)[0] print(decode_predictions(preds, top=3)[0]) f.save(path) return render_template('uploaded.html', title='Success', predictions=preds_decoded, user_image=f.filename)
The main.py is using the imagenet weights instead if the new trained model weights. In the function, upload file is not importing the model with the updated weights.
Look at the model being used -
model= ResNet50(weights='imagenet')
@app.route('/uploaded', methods = ['GET', 'POST']) def upload_file(): if request.method == 'POST': f = request.files['file'] path = os.path.join(app.config['UPLOAD_FOLDER'], f.filename) model= ResNet50(weights='imagenet') img = image.load_img(path, target_size=(224,224)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) preds_decoded = decode_predictions(preds, top=3)[0] print(decode_predictions(preds, top=3)[0]) f.save(path) return render_template('uploaded.html', title='Success', predictions=preds_decoded, user_image=f.filename)