加入了模型批量检测,优化窗口布局

main
wangchunlin 3 years ago
parent 6ed89d0a02
commit 4f369658d9

@ -1 +1 @@
Subproject commit 1d4cf9249f723166ceaea3573becbba4a7726916
Subproject commit 549f9a60c2e04771fd45ed8420e012cad28a4094

@ -40,7 +40,7 @@
$("#class").change(function () {
$("#model").empty();//清空回调列表;
var val = this.value;
console.log("选择的检测类别:", val);
console.log("选择的检测类别:", Object.keys(dic_class)[val-1]);
$.each(dic_class, function (i, n) { //each()方法为每个匹配元素规定要运行的函数;
if (Object.keys(dic_class)[val-1] == i) {
$.each(dic_class[i], function (j,m) {
@ -58,10 +58,10 @@
<script>
var dic_class={};//创建一个字典;
dic_class["外破"]=["外破ljp4500张四类v5v3", "外破ljp4500张四类v5v7", "外破ljp4500张四类v5v7m", "烟火与塔吊", "外破ljp4500张四类v5v7m6", "yolov3-tiny四类(正式使用)", "yolov3-tiny两类(正式使用)"]
dic_class["山火"]=["小模型", "大模型", "泛模型"]
dic_class["绝缘子"]=["绝缘子缺陷ljp2000张两类v5v7"]
dic_class["一般物体80类"]=["v5sv7"]
dic_class["外破"]=["所有模型", "外破ljp4500张四类v5v3", "外破ljp4500张四类v5v7", "外破ljp4500张四类v5v7m", "烟火与塔吊", "外破ljp4500张四类v5v7m6", "yolov3-tiny四类(正式使用)", "yolov3-tiny两类(正式使用)"]
dic_class["山火"]=["所有模型","小模型", "大模型", "泛模型"]
dic_class["绝缘子"]=["所有模型","绝缘子缺陷ljp2000张两类v5v7"]
dic_class["一般物体80类"]=["所有模型","v5sv7"]
$(document).ready(function(){
$("#model").empty();//清空回调列表;
@ -90,8 +90,35 @@ document.addEventListener("paste", function () {
// 字典 dict
var model = $('#model option:selected').val();
var model_class = $('#class option:selected').val();
console.log("检测类别与使用模型:", Object.keys(dic_class)[model_class-1], ',',dic_class[Object.keys(dic_class)[model_class-1]][model-1])
$.getJSON('/dlurl/', {'url':val, 'model':model, 'class':model_class,'model_name':dic_class[Object.keys(dic_class)[model_class-1]][model-1],'class_name':Object.keys(dic_class)[model_class-1]},function(res){ShowResult(res);});
if(model==1) {
console.log("检测类别所有模型:",Object.keys(dic_class)[model_class-1])
var date = new Date(); //时间对象
var str = date.getTime(); //转换成时间戳
var num = dic_class[Object.keys(dic_class)[model_class-1]].length-1
var table = $("<table id='" + str + "' class='main_css'></table>").prependTo($("#img"))
console.log("检测总数:", num)
for(var i=0; i<Math.ceil(num/3);i++) {
var tr = $("<tr id='" + i + "'></tr>").appendTo(table)
var last_num
if((num-i*3)>2){last_num=3}else{last_num=num-i*3}
for(var j=0;j<last_num;j++){
var td = $("<td id='" + j + "'></td>").appendTo(tr)
}
}
$.each(dic_class[Object.keys(dic_class)[model_class-1]], function (j,m) {
var model_num_count = j+1;
if(model_num_count==1) {
return true;
}
$.getJSON('/dlurl/', {'url':val, 'model':model_num_count, 'class':model_class,'model_name':dic_class[Object.keys(dic_class)[model_class-1]][model_num_count-1],'class_name':Object.keys(dic_class)[model_class-1]},function(res){ShowResult(res, num, j-1, table);});
})
}
else {
console.log("检测类别与使用模型:", Object.keys(dic_class)[model_class-1], ',',dic_class[Object.keys(dic_class)[model_class-1]][model-1])
$.getJSON('/dlurl/', {'url':val, 'model':model, 'class':model_class,'model_name':dic_class[Object.keys(dic_class)[model_class-1]][model-1],'class_name':Object.keys(dic_class)[model_class-1]},function(res){ShowResult(res,1);});
}
}
});
</script>
@ -108,28 +135,40 @@ layui.use('upload', function(){
'csrfmiddlewaretoken':function(){
return $(':input:first').val()
}
, 'model':function(){
var model = $('#model option:selected').val();
return model;
}
, 'class':function(){
var model_class = $('#class option:selected').val();
return model_class;
}
, 'model_name':function(){
var model_class = $('#class option:selected').val();
var model = $('#model option:selected').val();
var model_name=dic_class[Object.keys(dic_class)[model_class-1]][model-1];
return model_name;
}
, 'class_name':function(){
var model_class = $('#class option:selected').val();
var class_name=Object.keys(dic_class)[model_class-1];
return class_name;
}
}
,done: function(res){
ShowResult(res);
// 字典 dict
var model = $('#model option:selected').val();
var model_class = $('#class option:selected').val();
if(model==1) {
console.log("检测类别所有模型:",Object.keys(dic_class)[model_class-1])
var date = new Date(); //时间对象
var str = date.getTime(); //转换成时间戳
var num = dic_class[Object.keys(dic_class)[model_class-1]].length-1
var table = $("<table id='" + str + "'></table>").prependTo($("#img"))
console.log("检测总数:", num)
for(var i=0; i<Math.ceil(num/3);i++) {
var tr = $("<tr id='" + i + "'></tr>").appendTo(table)
var last_num
if((num-i*3)>2){last_num=3}else{last_num=num-i*3}
for(var j=0;j<last_num;j++){
var td = $("<td id='" + j + "'></td>").appendTo(tr)
}
}
$.each(dic_class[Object.keys(dic_class)[model_class-1]], function (j,m) {
var model_num_count = j+1;
if(model_num_count==1) {
return true;
}
$.getJSON('/dlurl/', {'url':res.upload_img_path, 'filename':res.source_image_name,'model':model_num_count, 'class':model_class,'model_name':dic_class[Object.keys(dic_class)[model_class-1]][model_num_count-1],'class_name':Object.keys(dic_class)[model_class-1]},function(res){ShowResult(res, num, j-1, table);});
})
}
else {
console.log("检测类别与使用模型:", Object.keys(dic_class)[model_class-1], ',',dic_class[Object.keys(dic_class)[model_class-1]][model-1])
$.getJSON('/dlurl/', {'url':res.upload_img_path, 'filename':res.source_image_name,'model':model, 'class':model_class,'model_name':dic_class[Object.keys(dic_class)[model_class-1]][model-1],'class_name':Object.keys(dic_class)[model_class-1]},function(res){ShowResult(res, 1);});
}
}
,error: function(){
}
@ -144,7 +183,7 @@ layui.use('upload', function(){
}
</script>
<script type="text/javascript">
function ShowResult(res){
function ShowResult(res, num, curnum, table){
if(res.flag == false)
{
alert("图片地址错误。")
@ -167,9 +206,20 @@ layui.use('upload', function(){
}
};
}
$("#img").prepend(i);
$("#img").prepend('<br>' +'<br>' + '<b>'+'<font size="4">'+"检测信息:"+res.code+'</font> '+"</b>"+'<br>');
if(num==1) {
$("#img").prepend(i);
$("#img").prepend('<br>' + '<b>'+'<font size="4">'+"检测信息:"+res.code+res.msg+'</font> '+"</b>"+'<br>');
}
else {
var tr_num = Math.floor(curnum/3)
var td_num = curnum-Math.floor(curnum/3)*3
var w = $(window).width()
var img = $('<img class="img1" alt="" src="' + res.img_name + '" onload="DrawImg(' + Math.floor(w/3) + ',600);" />')
table.find("tr:eq('" + tr_num + "') td:eq('" + td_num + "')").prepend(img);
table.find("tr:eq('" + tr_num + "') td:eq('" + td_num + "')").prepend('<b>'+'<font size="2">'+"检测信息:"+res.code+'</font>'+"</b>");
//$('.main_css').css('width','1000px')
}
}
function AutoResizeImage(maxWidth,maxHeight,objImg){
var img = new Image();
img.src = objImg.src;
@ -196,6 +246,31 @@ layui.use('upload', function(){
objImg.height = h;
objImg.width = w;
}
function DrawImg(boxWidth,boxHeight)
{
var imgWidth=$(".img1").width();
var imgHeight=$(".img1").height();
//比较imgBox的长宽比与img的长宽比大小
if((boxWidth/boxHeight)>=(imgWidth/imgHeight))
{
//重新设置img的width和height
$(".img1").width((boxHeight*imgWidth)/imgHeight);
$(".img1").height(boxHeight);
//让图片居中显示
var margin=(boxWidth-$(".img1").width())/2;
$(".img1").css("margin-left",margin);
}
else
{
//重新设置img的width和height
$(".img1").width(boxWidth);
$(".img1").height((boxWidth*imgHeight)/imgWidth);
//让图片居中显示
//var margin=(boxHeight-$(".img1").height())/2;
var margin=10
$(".img1").css("margin-top",margin);
}
}
</script>
<div id="resContainer">
</div>

@ -10,6 +10,7 @@ from pathlib import PosixPath
import requests, os, json
import cv2
import numpy as np
from shutil import copyfile
def adb_shell(cmd):
result = subprocess.getstatusoutput(cmd)
@ -44,24 +45,15 @@ def detect_brightness():
def upload(request):
if request.method == 'POST':
file = request.FILES.get('file') #获取前端上传的文件
m_model=request.POST.get('model')
m_class=request.POST.get('class')
model_name = request.POST.get("model_name")
class_name = request.POST.get("class_name")
print(request.POST["model_name"])
print(request.POST["class_name"])
fix = datetime.now().strftime('%Y%m%d%H%M%S%f')+'1' #给文件加前缀防止文件名重复
#以下用绝对路径存储文件,之前我用相对路径一直写不对
curPath = os.path.abspath( os.path.dirname( __file__ ) )
img_path = os.path.abspath(curPath+'/static/upload/'+fix+file.name)
#返回给前端的图片路径用相对路径,前端用绝对路径反而加载不了图片
img_path_res = '/static/detected/'+fix+file.name
img_path = os.path.abspath(curPath+'/static/upload/'+file.name)
print(img_path)
f = open(img_path,'wb')
for i in file.chunks():
f.write(i)
f.close()
return inference(m_class, m_model, curPath, img_path_res, img_path, model_name, class_name)
return JsonResponse({'upload_img_path':img_path, 'source_image_name':file.name})
def dlurl(request):
@ -75,67 +67,31 @@ def dlurl(request):
print(request.GET["class_name"])
print("m_model:",m_model)
print("url:",url)
name = url.split(r'/')[-1]
if not (name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".png") or name.endswith(".bmp")):
return JsonResponse({'flag': False})
if(("filename") in request.GET):
print("上传图片模式")
fix = datetime.now().strftime('%Y%m%d%H%M%S%f')+'1' #给文件加前缀防止文件名重复
source_img_path=request.GET["url"]
img_path = os.path.join(os.path.dirname(source_img_path),fix+request.GET["filename"])
copyfile(source_img_path,img_path)
img_path_res = '/static/detected/'+fix+request.GET["filename"]
curPath = os.path.abspath( os.path.dirname( __file__ ) )
else:
print("下载URL模式")
name = url.split(r'/')[-1]
if not (name.endswith(".jpg") or name.endswith(".jpeg") or name.endswith(".png") or name.endswith(".bmp")):
return JsonResponse({'flag': False})
fix = datetime.now().strftime('%Y%m%d%H%M%S%f')+'1' #给文件加前缀防止文件名重复
curPath = os.path.abspath( os.path.dirname( __file__ ) )
img_path = os.path.abspath(curPath+'/static/download/'+fix+name)
r = requests.get(url)
# 保存
with open (img_path, 'wb') as f:
f.write(r.content)
f.close
#返回给前端的图片路径用相对路径,前端用绝对路径反而加载不了图片
img_path_res = '/static/detected/'+fix+name
fix = datetime.now().strftime('%Y%m%d%H%M%S%f')+'1' #给文件加前缀防止文件名重复
curPath = os.path.abspath( os.path.dirname( __file__ ) )
img_path = os.path.abspath(curPath+'/static/download/'+fix+name)
r = requests.get(url)
# 保存
with open (img_path, 'wb') as f:
f.write(r.content)
f.close
#返回给前端的图片路径用相对路径,前端用绝对路径反而加载不了图片
img_path_res = '/static/detected/'+fix+name
return inference(m_class, m_model, curPath, img_path_res, img_path, model_name, class_name)
'''
result = adb_shell("ImageDetect/build/ImageDetect {}".format(img_path))
if result[0]==0:
cast = result[1].split("||")[0]
da = result[1].split("||")[1]
satu = result[1].split("||")[2]
CON = result[1].split("||")[3]
ASM = result[1].split("||")[4]
ENT = result[1].split("||")[5]
MEAN = result[1].split("||")[6]
sb = result[1].split("||")[7]
lap = result[1].split("||")[8]
dev = result[1].split("||")[9]
print(cast, da, satu)
mesg = "颜色分布(0-1合理):{}&nbsp;&nbsp;&nbsp;分布方差(负数偏暗):{}&nbsp;&nbsp;&nbsp;色彩饱和度(零为补光):{}<br/>对比度:{}&nbsp;&nbsp;&nbsp;角度方向二阶矩:{}&nbsp;&nbsp;&nbsp;熵:{}&nbsp;&nbsp;&nbsp;平均值:{}&nbsp;&nbsp;&nbsp;Sobel:{}&nbsp;&nbsp;&nbsp;Lap:{}&nbsp;&nbsp;&nbsp;dev:{}".format(cast, da, satu, CON, ASM, ENT, MEAN,sb,lap,dev)
if(int(m_class)==1):
if(int(m_model)==1): #小模型
RR = DL.run(weights=(curPath+"/yolov5/v3s.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【烟火 小模型】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_model)==2): #大模型
RR = DL.run(weights=(curPath+"/yolov5/v6m6.pt"), source=img_path, imgsz=(1280, 1280), project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【烟火 大模型】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_model)==3): #泛模型
RR = DL.run(weights=(curPath+"/yolov5/best.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【烟火 泛模型】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==2):
RR = DL.run(weights=(curPath+"/yolov5/yolov5s.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【一般物体检测】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==3):
RR = DL.run(weights=(curPath+"/yolov5/fire_smoke_towercrane.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【烟火+塔吊】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==4):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v3.0.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【外破四类】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==5):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【外破四类】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==6):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0m.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【外破四类】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_class)==7):
RR = DL.run(weights=(curPath+"/yolov5/birdpecked_unnormal_version1.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':"【绝缘子两类】"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
'''
def home(request):
return render(request, 'home.html')
@ -158,45 +114,53 @@ def inference(m_class, m_model, curPath, img_path_res, img_path, model_name, cla
if(int(m_class)==1): #外破
if(int(m_model)==1):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v3.0.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v3.0.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
print("使用所有模型检测")
if(int(m_model)==2):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v3.0.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v3.0.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==3):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_model)==3):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0m.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0m.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==4):
RR = DL.run(weights=(curPath+"/yolov5/fire_smoke_towercrane.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"fire_smoke_towercrane.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0m.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0m.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==5):
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0m6.pt"), source=img_path, project=(curPath+"/static/detected"),imgsz=(1280,1280))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0m6.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
RR = DL.run(weights=(curPath+"/yolov5/fire_smoke_towercrane.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"fire_smoke_towercrane.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==6):
RR=RONNX.main(curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_4class.onnx", curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_4class.names", img_path, (curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"hy_vehicle_4class.onnx"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
RR = DL.run(weights=(curPath+"/yolov5/vehicle_4class_ljp_v7.0m6.pt"), source=img_path, project=(curPath+"/static/detected"),imgsz=(1280,1280))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"vehicle_4class_ljp_v7.0m6.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==7):
RR=RONNX.main(curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_4class.onnx", curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_4class.names", img_path, (curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"hy_vehicle_4class.onnx"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==8):
RR=RONNX.main(curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_2class.onnx", curPath+"/Darknet2Pytorch2Onnx/hy_vehicle_2class.names", img_path, (curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"hy_vehicle_2class.onnx"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"hy_vehicle_2class.onnx"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_class)==2): #山火
if(int(m_model)==1): # 小
if(int(m_model)==1):
print("使用所有模型检测")
if(int(m_model)==2): # 小
RR = DL.run(weights=(curPath+"/yolov5/v3s.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"v3s.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_model)==2): # 大
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"v3s.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==3): # 大
RR = DL.run(weights=(curPath+"/yolov5/v6m6.pt"), source=img_path, imgsz=(1280, 1280), project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"v6m6.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
if(int(m_model)==3): # 范模型
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"v6m6.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_model)==4): # 范模型
RR = DL.run(weights=(curPath+"/yolov5/best.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"best.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"best.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_class)==3): # 绝缘子
if(int(m_model)==1):
print("使用所有模型检测")
if(int(m_model)==2):
RR = DL.run(weights=(curPath+"/yolov5/birdpecked_unnormal_version1.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"birdpecked_unnormal_version1.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"birdpecked_unnormal_version1.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})
if(int(m_class)==4): # 一般物体coco
if(int(m_model)==1): #yolov5s
if(int(m_model)==1):
print("使用所有模型检测")
if(int(m_model)==2): #yolov5s
RR = DL.run(weights=(curPath+"/yolov5/yolov5s.pt"), source=img_path, project=(curPath+"/static/detected"))
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"yolov5s.pt"+' <br/> '+RR+' <br/> '+mesg, 'flag': True})
return JsonResponse({'img_name':img_path_res,'code':class_name+":"+model_name+",模型: "+"yolov5s.pt"+' <br/> '+RR+' <br/> ',"msg":mesg, 'flag': True})

@ -1 +1 @@
Subproject commit aded49418b7c23dc1dcf7e62fcdaeef7f3feea5b
Subproject commit fc08e6c13803803ded26c0e1d2664da396fa115e
Loading…
Cancel
Save