def showpredicpic(idx, model): pic_data, label1 = getdatabyid(idx) print "id:%s label1====>%s" % (idx, label1) img = dp.pm(pic_data) xi = dp.pm3(dp.pm2(img)) yi = model.predict(xi)[0] if int(yi) >= 10: yi = chr(yi + 55) print "id:%s pridict===>%s" % (idx, yi) img = dp.pm2(img) img = img > 100 pylab.imshow(img, 'gray') pylab.pause(2) pylab.show(block=False) pylab.close() return yi
def showpredicbyfile2(filename, model): data = dp.splitimg(filename) label = '' for i in data: x = dp.pm3(dp.pm2(i)) yi = model.predict(x)[0] if int(yi) >= 10: yi = chr(yi + 55) label = label + str(yi) img = cv2.imread(filename) img = dp.pm2(img) img = img > 100 pylab.imshow(img, 'gray') pylab.pause(2) pylab.show(block=False) pylab.close() return label
def showpredicpic(idx, model): pic_data, label1 = getdatabyid(idx) print "id:%s label1====>%s" % (idx, label1) img = dp.pm(pic_data) xi = dp.pm3(dp.pm2(img)) yi = model.predict(xi)[0] if int(yi) >= 10: yi = chr(yi + 55) print "id:%s pridict===>%s" % (idx, yi) cv2.namedWindow(str(yi), 0) cv2.resizeWindow(str(yi), 400, 400) cv2.moveWindow(str(yi), 400, 200) cv2.imshow(str(yi), img) cv2.waitKey(1500) cv2.destroyAllWindows() return yi
def showpredicbyfile(filename, model): data = dp.splitimg(filename) label = '' for i in data: x = dp.pm3(dp.pm2(i)) yi = model.predict(x)[0] if int(yi) >= 10: yi = chr(yi + 55) label = label + str(yi) img = cv2.imread(filename) cv2.namedWindow(label, 0) cv2.resizeWindow(label, 400, 400) cv2.moveWindow(label, 400, 200) cv2.imshow(label, img) cv2.waitKey(1500) cv2.destroyAllWindows() return label