You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I copy and run this code(and copy images and model.py) :
from matplotlib import pyplot as plt
import cv2 # used for resize. if you dont have it, use anything else
import numpy as np
from model import Deeplabv3
img = plt.imread("imgs/image1.jpg")
print(img.shape)
w, h, _ = img.shape
ratio = 512. / np.max([w,h])
resized = cv2.resize(img,(int(ratioh),int(ratiow)))
resized = resized / 127.5 - 1.
new_deeplab_model = Deeplabv3(input_shape=(512,512,3), OS=16)
ERROR:root:An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 2))
TypeError Traceback (most recent call last)
in ()
26 # make prediction
27 deeplab_model = Deeplabv3()
---> 28 res = deeplab_model.predict(np.expand_dims(resized_image, 0))
29 labels = np.argmax(res.squeeze(), -1)
30
10 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
966 func_graph: A FuncGraph object to destroy. func_graph is unusable
967 after this function.
--> 968 """
969 # TODO(b/115366440): Delete this method when a custom OrderedDict is added.
970 # Clearing captures using clear() leaves some cycles around.
I copy and run this code(and copy images and model.py) :
from matplotlib import pyplot as plt
import cv2 # used for resize. if you dont have it, use anything else
import numpy as np
from model import Deeplabv3
img = plt.imread("imgs/image1.jpg")
print(img.shape)
w, h, _ = img.shape
ratio = 512. / np.max([w,h])
resized = cv2.resize(img,(int(ratioh),int(ratiow)))
resized = resized / 127.5 - 1.
new_deeplab_model = Deeplabv3(input_shape=(512,512,3), OS=16)
pad_x = int(512 - resized.shape[0])
resized2 = np.pad(resized,((0,pad_x),(0,0),(0,0)), mode='constant')
res = new_deeplab_model.predict(np.expand_dims(resized2,0))
res_old = old_deeplab_model.predict(np.expand_dims(resized2,0))
labels = np.argmax(res.squeeze(),-1)
labels_old = np.argmax(res_old.squeeze(),-1)
plt.imshow(labels[:-pad_x])
plt.show()
plt.imshow(labels_old[:-pad_x])
plt.show()
`
but I get this error =>
ERROR:root:An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 2))
TypeError Traceback (most recent call last)
in ()
26 # make prediction
27 deeplab_model = Deeplabv3()
---> 28 res = deeplab_model.predict(np.expand_dims(resized_image, 0))
29 labels = np.argmax(res.squeeze(), -1)
30
10 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
966 func_graph: A
FuncGraph
object to destroy.func_graph
is unusable967 after this function.
--> 968 """
969 # TODO(b/115366440): Delete this method when a custom OrderedDict is added.
970 # Clearing captures using clear() leaves some cycles around.
TypeError: in user code:
The text was updated successfully, but these errors were encountered: