import cv2
import numpy as np
#from cv2.dnn import dnn
#image = cv2.imread('.//imagesop(1)//validation//k//image01.jpeg')
image = cv2.imread('.//imagesop(1)//imagesop//validation//k//image01.jpeg')
#print(image.shape)
ip=image.shape[0]/3
jp=image.shape[1]/3
def get_face_data(image):
net = cv2.dnn.readNetFromTensorflow('./pb/modelx.pb')
font = cv2.FONT_HERSHEY_SIMPLEX
count = 1
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = cv2.resize(image, (150, 150))
img_tensor = cv2.dnn.blobFromImage(image, 1 / 255.0, (0, 0), swapRB=False, crop=False)
net.setInput(img_tensor)
ln = net.getUnconnectedOutLayersNames()
prediction = net.forward(ln)
# print(prediction[0][0])
if prediction[0][0]>0.5:
result='no'
else:
result='yes'
print(result)
# cv2.imshow("aaa",image)
# cv2.waitKey(1000)
# cv2.destroyAllWindows()
for i in range(1,4):
for j in range(1,4):
i1=int((i-1)*ip)
i2=int(i*ip)
j1=int((j-1)*jp)
j2=int(j*jp)
img=image[i1:i2,j1:j2]
if __name__=='__main__':
get_face_data(img)