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
ValueError: Tensor Tensor("concatenate_1/concat:0", shape=(?, ?, ?, 8), dtype=float32) is not an element of this graph.
I am trying to receive an image from using socket io and then trying to apply it to wpod net for number plate detection. But I am getting above mentioned error.
if len(R):
L = dknet_label_conversion(R,width,height)
L = nms(L,.45)
L.sort(key=lambda x: x.tl()[0])
lp_str = ''.join([chr(l.cl()) for l in L])
print("License Plate Detected: ", lp_str)`
The text was updated successfully, but these errors were encountered:
bhargavravat
changed the title
ValueError: Tensor Tensor("concatenate_1/concat:0", shape=(?, ?, ?, 8), dtype=float32) is not an element of this graph.
Unable to load wpod model
Oct 12, 2020
Check if this helps you
We need wpod-net.json file as well to load the model. I don't see any .json file being read in your code.
I am able to load the wpod model successfully
ValueError: Tensor Tensor("concatenate_1/concat:0", shape=(?, ?, ?, 8), dtype=float32) is not an element of this graph.
I am trying to receive an image from using socket io and then trying to apply it to wpod net for number plate detection. But I am getting above mentioned error.
Here is the code snippet
output_dir = 'lp_images/' lp_threshold = .5 wpod_net_path = 'data/lp-detector/wpod-net_update1.h5' wpod_net = load_model(wpod_net_path) ocr_threshold = .4 ocr_weights = 'data/ocr/ocr-net.weights' ocr_netcfg = 'data/ocr/ocr-net.cfg' ocr_dataset = 'data/ocr/ocr-net.data' ocr_net = dn.load_net(ocr_netcfg.encode(), ocr_weights.encode(), 0) ocr_meta = dn.load_meta(ocr_dataset.encode())
`
def anpr_detection(img_np, Rwidth , Rheight, sId , ske):
print ("In Side anpr_detection ======>")
frame = img_np
w = frame.shape[0]
h = frame.shape[1]
ratio = float(max(frame.shape[:2]))/min(frame.shape[:2])
side = int(ratio*288.)
bound_dim = min(side + (side%(24)),608)
print ("bound_dim ==>",bound_dim)
print (type(frame))
#wpod_net = load_model(wpod_net_path)
Llp,LlpImgs,_ = detect_lp(wpod_net,im2single(frame),bound_dim,24,(240,80),lp_threshold)
if len(LlpImgs) > 0:
print ("LlpImgs ========> ")
Ilp = LlpImgs[0]
s = Shape(Llp[0].pts)
for shape in [s]:
ptsarray = shape.pts.flatten()
try:
frame = cv2.rectangle(frame,(int(ptsarray[0]*h), int(ptsarray[5]*w)),(int(ptsarray[1]*h),int(ptsarray[6]*w)),(0,255,0),3)
X1 = int(ptsarray[0]*h)
Y1 = int(ptsarray[5]*w)
X2 = int(ptsarray[1]*h)
Y2 = int(ptsarray[6]w)
Pwidth = X2 - X1
Pheight = Y2 - Y1
except:
traceback.print_exc()
sys.exit(1)
cv2.imwrite('%s/_lp.png' % (output_dir),Ilp255.)
R,(width,height) = detect(ocr_net, ocr_meta, 'lp_images/_lp.png'.encode() ,thresh=ocr_threshold, nms=None)
The text was updated successfully, but these errors were encountered: