Commit 26c55ff4 authored by dasharatha.vamshi's avatar dasharatha.vamshi

changes

parent 2723ecc3
......@@ -53,7 +53,7 @@ class Welspun_Classifier(ModelWrapper):
self.update_net(self.net1)
logger.info("Loading model to the device")
self.exec_net = self.ie.load_network(network=self.net1, device_name="CPU")
self.defect_type = ""
self.frame_skip_count = 25
self.counter = 0
......@@ -227,40 +227,63 @@ class Welspun_Classifier(ModelWrapper):
self.counter = self.counter + 1
if a == 0 and x[0] > 0.95:
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Mix Color Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
if self.counter % 50 == 0:
if self.defect_type == 'Mix':
pass
else:
self.defect_type = 'Mix'
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Mix Color Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
self.send_payload("Mix Color Detected", resized_frame, "Mix Color " + str(prob[0]), "#472020",
"#ed2020",
"sound_1")
logger.info(f"Probability: {prob}")
self.counter = 0
# if self.counter % 50 == 0:
# self.send_payload("Mix Color Detected", resized_frame, "Mix Color " + str(prob[0]), "#472020",
# "#ed2020",
# "sound_1")
# logger.info(f"Probability: {prob}")
# self.counter = 0
elif a == 2 and x[2] > 0.95:
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Short Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
if self.counter % 50 == 0:
if self.defect_type == 'Short':
pass
else:
self.defect_type = 'Short'
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Short Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
self.send_payload("Short Tile Detected", resized_frame, "Short Tile " + str(prob[2]), "#472020",
"#ed2020",
"sound_1")
logger.info(f"Probability: {prob}")
self.counter = 0
# if self.counter % 50 == 0:
# self.send_payload("Short Tile Detected", resized_frame, "Short Tile " + str(prob[2]), "#472020",
# "#ed2020",
# "sound_1")
# logger.info(f"Probability: {prob}")
# self.counter = 0
elif a == 3 and x[3] > 0.95:
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Split Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
if self.counter % 50 == 0:
if self.defect_type == 'Split':
pass
else:
self.defect_type = 'Split'
resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Split Defect Detected", org=(50, 50),
color=(0, 0, 255),
thickness=2,
fontScale=1, fontFace=cv2.LINE_AA)
self.send_payload("Split Defect Detected", resized_frame, "Split " + str(prob[3]), "#472020", "#ed2020",
"sound_1")
logger.info(f"Probability: {prob}")
self.counter = 0
# if self.counter % 50 == 0:
# self.send_payload("Split Defect Detected", resized_frame, "Split " + str(prob[3]), "#472020", "#ed2020",
# "sound_1")
# logger.info(f"Probability: {prob}")
# self.counter = 0
elif a == 2:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment