Closed deepik27 closed 3 years ago
There are many examples of this error on StackOverflow. Have you tried changing your Keras import statements as shown in the answers to this question?
If that doesn't help, please post the full stack trace, and the relevant sections of your code.
Actually here is my model.h5 file link, i am getting same issue when i use with android studio and suppose if i use in visual studio i am not getting any issues, below i will attach the code also
https://drive.google.com/file/d/1UclOhWDd6o-VV388fj_9JXE1KeZMmLQO/view?usp=sharing
import numpy as np import cv2 from skimage.transform import resize from tensorflow import keras import pickle from moviepy.editor import VideoFileClip
model = keras.models.load_model('full_CNN_model.h5')
class Lanes(): def init(self): self.recent_fit = [] self.avg_fit = []
def road_lines(image):
recent_fit=[] avg_fit=[] small_img = resize(image,(80,160,3)) small_img = np.array(small_img) small_img = small_img[None,:,:,:]
prediction = model.predict(small_img)[0] * 255
recent_fit.append(prediction)
if len(recent_fit) > 5: recent_fit = recent_fit[1:]
avg_fit = np.mean(np.array([i for i in recent_fit]),axis=0)
blanks = np.zeros_like(avg_fit).astype(np.uint8)
lane_drawn = np.dstack((blanks,avg_fit,blanks)) print("Deepika", lane_drawn)
lane_image = resize(lane_drawn, image.shape)
return lane_image
And the full stack trace please.
If this is still a problem, please provide the requested information and I'll reopen the issue.
I want to use .h5 file in android studio using chaquopy for lane detection, but i am getting the error has below
com.chaquo.python.PyException: ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context
or please suggest me how to use model.h5 file using tensorflow
hi can i ask how you install keras in chaqoupy for you to use your model?
Keras now comes with TensorFlow, it doesn't need to be installed separately.
I want to use .h5 file in android studio using chaquopy for lane detection, but i am getting the error has below
com.chaquo.python.PyException: ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context
or please suggest me how to use model.h5 file using tensorflow