up log
This commit is contained in:
@ -143,7 +143,7 @@ def detect(opt, save_img=False):
|
|||||||
s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else ''
|
s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else ''
|
||||||
print(f"Results saved to {save_dir}{s}")
|
print(f"Results saved to {save_dir}{s}")
|
||||||
|
|
||||||
print(f'Done. ({time.time() - t0:.3f}s)')
|
# print(f'Done. ({time.time() - t0:.3f}s)')
|
||||||
|
|
||||||
names = ["6925303773908", "6924743915848", "6920152471616", "6920005772716", "6902227018162",
|
names = ["6925303773908", "6924743915848", "6920152471616", "6920005772716", "6902227018162",
|
||||||
"6920459905012", "6972194461407", "6935284412918", "6921489033706", "6904012526494",
|
"6920459905012", "6972194461407", "6935284412918", "6921489033706", "6904012526494",
|
||||||
@ -153,7 +153,6 @@ def detect(opt, save_img=False):
|
|||||||
targets.append({"Class": names[int(target[5].item())], "precision": target[4].item(), "xy1": [target[0].item(), target[1].item()],
|
targets.append({"Class": names[int(target[5].item())], "precision": target[4].item(), "xy1": [target[0].item(), target[1].item()],
|
||||||
"xy2": [target[2].item(), target[3].item()]})
|
"xy2": [target[2].item(), target[3].item()]})
|
||||||
resu = {"TargetDetect": targets}
|
resu = {"TargetDetect": targets}
|
||||||
print(resu)
|
|
||||||
return resu
|
return resu
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ parser.add_argument('--conf-thres', type=float, default=0.70, help='object confi
|
|||||||
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
||||||
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
||||||
parser.add_argument('--view-img', type=bool, default=True, help='display results')
|
parser.add_argument('--view-img', type=bool, default=True, help='display results')
|
||||||
parser.add_argument('--save-txt', type=bool, default=True, help='save results to *.txt')
|
parser.add_argument('--save-txt', type=bool, default=False, help='save results to *.txt')
|
||||||
parser.add_argument('--save-conf', type=bool, default=True, help='save confidences in --save-txt labels')
|
parser.add_argument('--save-conf', type=bool, default=True, help='save confidences in --save-txt labels')
|
||||||
parser.add_argument('--nosave', type=bool, default=True, help='do not save images/videos')
|
parser.add_argument('--nosave', type=bool, default=True, help='do not save images/videos')
|
||||||
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
|
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
|
||||||
@ -80,10 +80,10 @@ parser.add_argument('--exist-ok', type=bool, default=True, help='existing projec
|
|||||||
opt, unknown = parser.parse_known_args()
|
opt, unknown = parser.parse_known_args()
|
||||||
@app.route("/zhanting", methods=['POST'])
|
@app.route("/zhanting", methods=['POST'])
|
||||||
def get_isempty():
|
def get_isempty():
|
||||||
#start = time.time()
|
start = time.time()
|
||||||
data = request.get_data()
|
data = request.get_data()
|
||||||
ip = request.remote_addr
|
ip = request.remote_addr
|
||||||
print('------ ip = %s ------' % ip)
|
logger.info(f"client ip:{ip}")
|
||||||
|
|
||||||
json_data = json.loads(data.decode("utf-8"))
|
json_data = json.loads(data.decode("utf-8"))
|
||||||
# getdateend = time.time()
|
# getdateend = time.time()
|
||||||
@ -95,7 +95,7 @@ def get_isempty():
|
|||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
imgdata = base64.b64decode(pic)
|
imgdata = base64.b64decode(pic)
|
||||||
#image_path = 'data/images/1.jpg'
|
#image_path = 'imgs/1.jpg'
|
||||||
image_path = '../module/ieemoo-ai-zhanting/imgs/1.jpg'
|
image_path = '../module/ieemoo-ai-zhanting/imgs/1.jpg'
|
||||||
file = open(image_path, 'wb')
|
file = open(image_path, 'wb')
|
||||||
file.write(imgdata)
|
file.write(imgdata)
|
||||||
@ -112,6 +112,7 @@ def get_isempty():
|
|||||||
pred = detect.detect(opt)
|
pred = detect.detect(opt)
|
||||||
logger.info(pred)
|
logger.info(pred)
|
||||||
Obs(image_path)
|
Obs(image_path)
|
||||||
|
logger.info("all time:%.3fs" % (time.time() - start))
|
||||||
#print('pred', pred)
|
#print('pred', pred)
|
||||||
#getdateend = time.time()
|
#getdateend = time.time()
|
||||||
#now_time = datetime.datetime.now()
|
#now_time = datetime.datetime.now()
|
||||||
@ -126,6 +127,6 @@ def get_isempty():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host='192.168.1.142', port=8000)
|
app.run(host='192.168.1.142', port=8009)
|
||||||
#http_server = WSGIServer(('0.0.0.0', 8000), app)
|
#http_server = WSGIServer(('0.0.0.0', 8000), app)
|
||||||
#http_server.serve_forever()
|
#http_server.serve_forever()
|
||||||
|
@ -24,7 +24,7 @@ def caculate_label_numble(file_path):
|
|||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
|
|
||||||
file_path = "paper_data/Annotations"
|
file_path = r"D:\PycharmProjects\ieemoo-ai-pack\paper_data\Annotations"
|
||||||
label_numble_info = caculate_label_numble(file_path)
|
label_numble_info = caculate_label_numble(file_path)
|
||||||
for key, value in label_numble_info.items():
|
for key, value in label_numble_info.items():
|
||||||
print('{}:{}'.format(key, value))
|
print('{}:{}'.format(key, value))
|
||||||
|
@ -165,7 +165,7 @@ class Model(nn.Module):
|
|||||||
# print('%10.3g' % (m.w.detach().sigmoid() * 2)) # shortcut weights
|
# print('%10.3g' % (m.w.detach().sigmoid() * 2)) # shortcut weights
|
||||||
|
|
||||||
def fuse(self): # fuse model Conv2d() + BatchNorm2d() layers
|
def fuse(self): # fuse model Conv2d() + BatchNorm2d() layers
|
||||||
print('Fusing layers... ')
|
# print('Fusing layers... ')
|
||||||
for m in self.model.modules():
|
for m in self.model.modules():
|
||||||
if type(m) is Conv and hasattr(m, 'bn'):
|
if type(m) is Conv and hasattr(m, 'bn'):
|
||||||
m.conv = fuse_conv_and_bn(m.conv, m.bn) # update conv
|
m.conv = fuse_conv_and_bn(m.conv, m.bn) # update conv
|
||||||
|
@ -191,7 +191,7 @@ class LoadImages: # for inference
|
|||||||
# cv2.imshow("mask", img0)
|
# cv2.imshow("mask", img0)
|
||||||
# cv2.waitKey(0)
|
# cv2.waitKey(0)
|
||||||
assert img0 is not None, 'Image Not Found ' + path
|
assert img0 is not None, 'Image Not Found ' + path
|
||||||
print(f'image {self.count}/{self.nf} {path}: ', end='')
|
# print(f'image {self.count}/{self.nf} {path}: ', end='')
|
||||||
|
|
||||||
# Padded resize
|
# Padded resize
|
||||||
img = letterbox(img0, self.img_size, stride=self.stride)[0]
|
img = letterbox(img0, self.img_size, stride=self.stride)[0]
|
||||||
|
Reference in New Issue
Block a user