Commit 1dcd5d75 authored by dasharatha.vamshi's avatar dasharatha.vamshi

changes

parent a1998435
...@@ -190,7 +190,8 @@ class Welspun_Classifier(ModelWrapper): ...@@ -190,7 +190,8 @@ class Welspun_Classifier(ModelWrapper):
def process_frame(self, frame): def process_frame(self, frame):
starttime = time.time() starttime = time.time()
vino_frame = frame.copy() vino_frame = frame.copy()
vino_frame = vino_frame[20:600,150:650] # vino_frame = vino_frame[20:600,150:650]
vino_frame = vino_frame[5: 600, 70: 650]
images = np.ndarray(shape=(self.n, self.c, self.h, self.w)) images = np.ndarray(shape=(self.n, self.c, self.h, self.w))
images_hw = [] images_hw = []
for i in range(self.n): for i in range(self.n):
...@@ -234,28 +235,22 @@ class Welspun_Classifier(ModelWrapper): ...@@ -234,28 +235,22 @@ class Welspun_Classifier(ModelWrapper):
fontScale=1, fontFace=cv2.LINE_AA) fontScale=1, fontFace=cv2.LINE_AA)
# pass # pass
else: else:
# self.defect_type = 'Mix' self.defect_type = 'Mix'
resized_frame = cv2.resize(frame, (64, 64)) resized_frame = cv2.resize(frame, (64, 64))
# cv2.putText(frame, text="Mix Color Defect Detected", org=(50, 50), cv2.putText(frame, text="Mix Color Defect Detected", org=(50, 50),
# color=(0, 0, 255), color=(0, 0, 255),
# thickness=2, thickness=2,
# fontScale=1, fontFace=cv2.LINE_AA) fontScale=1, fontFace=cv2.LINE_AA)
# self.send_payload("Mix Color Detected", resized_frame, "Mix Color " + str(prob[0]), "#472020", self.send_payload("Mix Color Detected", resized_frame, "Mix Color " + str(prob[0]), "#472020",
# "#ed2020", "#ed2020",
# "sound_1") "sound_1")
# logger.info(f"Probability: {prob}") logger.info(f"Probability: {prob}")
if self.counter % 25 == 0: # if self.counter % 25 == 0:
self.defect_type = 'Mix' # self.send_payload("Mix Color Detected", resized_frame, "Mix Color " + str(prob[0]), "#472020",
resized_frame = cv2.resize(frame, (64, 64)) # "#ed2020",
cv2.putText(frame, text="Mix Color Defect Detected", org=(50, 50), # "sound_1")
color=(0, 0, 255), # logger.info(f"Probability: {prob}")
thickness=2, # self.counter = 0
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
elif a == 2 and x[2] > 0.95: elif a == 2 and x[2] > 0.95:
if self.defect_type == 'Short': if self.defect_type == 'Short':
cv2.putText(frame, text="Short Defect Detected", org=(50, 50), cv2.putText(frame, text="Short Defect Detected", org=(50, 50),
...@@ -264,17 +259,6 @@ class Welspun_Classifier(ModelWrapper): ...@@ -264,17 +259,6 @@ class Welspun_Classifier(ModelWrapper):
fontScale=1, fontFace=cv2.LINE_AA) fontScale=1, fontFace=cv2.LINE_AA)
# pass # pass
else: 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}")
if self.counter % 25 == 0:
self.defect_type = 'Short' self.defect_type = 'Short'
resized_frame = cv2.resize(frame, (64, 64)) resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Short Defect Detected", org=(50, 50), cv2.putText(frame, text="Short Defect Detected", org=(50, 50),
...@@ -285,7 +269,12 @@ class Welspun_Classifier(ModelWrapper): ...@@ -285,7 +269,12 @@ class Welspun_Classifier(ModelWrapper):
"#ed2020", "#ed2020",
"sound_1") "sound_1")
logger.info(f"Probability: {prob}") logger.info(f"Probability: {prob}")
self.counter = 0 # if self.counter % 25 == 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: elif a == 3 and x[3] > 0.95:
if self.defect_type == 'Split': if self.defect_type == 'Split':
cv2.putText(frame, text="Split Defect Detected", org=(50, 50), cv2.putText(frame, text="Split Defect Detected", org=(50, 50),
...@@ -294,16 +283,6 @@ class Welspun_Classifier(ModelWrapper): ...@@ -294,16 +283,6 @@ class Welspun_Classifier(ModelWrapper):
fontScale=1, fontFace=cv2.LINE_AA) fontScale=1, fontFace=cv2.LINE_AA)
# pass # pass
else: 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}")
if self.counter % 25 == 0:
self.defect_type = 'Split' self.defect_type = 'Split'
resized_frame = cv2.resize(frame, (64, 64)) resized_frame = cv2.resize(frame, (64, 64))
cv2.putText(frame, text="Split Defect Detected", org=(50, 50), cv2.putText(frame, text="Split Defect Detected", org=(50, 50),
...@@ -313,7 +292,11 @@ class Welspun_Classifier(ModelWrapper): ...@@ -313,7 +292,11 @@ class Welspun_Classifier(ModelWrapper):
self.send_payload("Split Defect Detected", resized_frame, "Split " + str(prob[3]), "#472020", "#ed2020", self.send_payload("Split Defect Detected", resized_frame, "Split " + str(prob[3]), "#472020", "#ed2020",
"sound_1") "sound_1")
logger.info(f"Probability: {prob}") logger.info(f"Probability: {prob}")
self.counter = 0 # if self.counter % 25 == 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: elif a == 2:
pass 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