Commit 22551b25 by xmh

基本完成

1 parent 72cea6fa
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<skipTests>true</skipTests>
</properties> </properties>
<dependencies> <dependencies>
......
package com.xmh.es.match;
/**
* .
*
* @author 谢明辉
* @date 2020/11/25
*/
public enum PoolEnum {
/** */
POOL_2K("test_pool_2k", 2000),
POOL_5K("test_pool_5k", 5000),
POOL_2W("test_pool_2w", 20000),
POOL_10W("test_pool_10w", 100000),
POOL_50W("test_pool_50w", 500000),
POOL_100W("test_pool_100w", 1000000),
POOL_200W("test_pool_200w", 2000000);
public String name;
public int num;
PoolEnum(String name, int num) {
this.name = name;
this.num = num;
}
}
...@@ -7,10 +7,9 @@ import org.springframework.context.annotation.ComponentScan; ...@@ -7,10 +7,9 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication @SpringBootApplication
@ComponentScan(basePackages = {"com.viontech.keliu", "com.xmh.es"}) @ComponentScan(basePackages = {"com.viontech.keliu", "com.xmh.es"})
public class XmhTestApplication { public class XmhTestApplication {
public final static String POOL_NAME = "test_pool";
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(XmhTestApplication.class, args); SpringApplication.run(XmhTestApplication.class, args);
} }
} }
\ No newline at end of file \ No newline at end of file
package com.xmh.es.match.controller; package com.xmh.es.match.controller;
import com.xmh.es.match.entity.MatchResult; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.viontech.keliu.storage.Storage;
import com.viontech.keliu.util.DateUtil;
import com.xmh.es.match.PoolEnum;
import com.xmh.es.match.entity.*;
import com.xmh.es.match.entity.vo.RequestData; import com.xmh.es.match.entity.vo.RequestData;
import com.xmh.es.match.repository.FaceRecognitionRepository; import com.xmh.es.match.repository.FaceRecognitionRepository;
import com.xmh.es.match.service.AlgService;
import com.xmh.es.match.service.MatchService; import com.xmh.es.match.service.MatchService;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.io.IOException;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -22,16 +32,153 @@ import java.util.stream.Collectors; ...@@ -22,16 +32,153 @@ import java.util.stream.Collectors;
@RequestMapping("/alg") @RequestMapping("/alg")
public class MainController { public class MainController {
private final ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(20, 30, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.CallerRunsPolicy());
private final AtomicInteger integer = new AtomicInteger();
@Resource
ObjectMapper objectMapper;
@Resource @Resource
private MatchService matchService; private MatchService matchService;
@Resource @Resource
private FaceRecognitionRepository faceRecognitionRepository; private FaceRecognitionRepository faceRecognitionRepository;
@Resource
private AlgService algService;
@Resource
private Storage featureStorage;
@PostMapping("/match") @PostMapping("/match")
public Object match(RequestData requestData) throws Exception { public Object match(RequestData requestData) throws Exception {
List<MatchResult> match = matchService.match(requestData); MultipartFile file = requestData.getFile();
Double[] data = matchService.extractFeature(file);
Person person = new Person().setFeature(data);
long begin = System.currentTimeMillis();
List<MatchResult> match = algService.matchPerson(person, requestData.getPoolId());
long timeConsumingMatching = System.currentTimeMillis() - begin;
List<String> collect = match.stream().map(MatchResult::getPersonId).collect(Collectors.toList()); List<String> collect = match.stream().map(MatchResult::getPersonId).collect(Collectors.toList());
return faceRecognitionRepository.queryFaceRecognitionByUnids(collect); List<FaceRecognition> faceRecognitions = faceRecognitionRepository.queryFaceRecognitionByUnids(collect);
if (faceRecognitions == null) {
return null;
}
Map<String, FaceRecognition> map = faceRecognitions.stream().collect(Collectors.toMap(FaceRecognition::getUnid, x -> x, (x, y) -> y));
for (MatchResult item : match) {
FaceRecognition faceRecognition = map.get(item.getPersonId());
if (faceRecognition != null) {
faceRecognition.setMatchScore(item.getScore());
}
}
Collection<FaceRecognition> values = map.values();
List<FaceRecognition> collect1 = values.stream().sorted((o1, o2) -> {
if (o1.getMatchScore() > o2.getMatchScore()) {
return -1;
} else if (o1.getMatchScore().equals(o2.getMatchScore())) {
return 0;
} else {
return 1;
}
}).collect(Collectors.toList());
HashMap<String, Object> resultMap = new HashMap<>(2);
resultMap.put("time", timeConsumingMatching);
resultMap.put("result", collect1);
return resultMap;
} }
@GetMapping("/poolIds")
public Object getPoolIds() throws IOException {
return algService.queryPoolList();
}
@GetMapping("/create/{num}")
public Object createPool(@PathVariable("num") Integer num) throws Exception {
PoolEnum pool;
switch (num) {
case 2000:
pool = PoolEnum.POOL_2K;
break;
case 5000:
pool = PoolEnum.POOL_5K;
break;
case 20000:
pool = PoolEnum.POOL_2W;
break;
case 100000:
pool = PoolEnum.POOL_10W;
break;
case 500000:
pool = PoolEnum.POOL_50W;
break;
case 1000000:
pool = PoolEnum.POOL_100W;
break;
case 2000000:
pool = PoolEnum.POOL_200W;
break;
default:
return "请输入[2000,5000,20000,100000,500000,1000000,2000000]";
}
algService.deletePool(pool.name);
algService.createPool(pool.name);
Date end = DateUtil.addDays(new Date(), -1);
Date start = DateUtil.addDays(end, -30);
integer.set(0);
List<Date> days = DateUtil.getDaysBetweenDates(start, end);
for (Date day : days) {
List<FaceRecognition> faceRecognitions = faceRecognitionRepository.queryFaceRecognitions(day, 2L);
for (FaceRecognition faceRecognition : faceRecognitions) {
poolExecutor.execute(() -> {
try {
if (integer.get() >= pool.num) {
return;
}
Double[] feature = getFeature(faceRecognition);
if (feature == null) {
return;
}
Person person = new Person();
person.setPersonId(faceRecognition.getPersonUnid());
person.setFeature(feature);
person.setId(faceRecognition.getUnid());
Object o = algService.addPerson(person, pool.name);
System.out.println(objectMapper.writeValueAsString(o));
integer.addAndGet(1);
} catch (Exception e) {
e.printStackTrace();
}
});
if (integer.get() > pool.num) {
return "success";
}
while (poolExecutor.getQueue().size() > 1000) {
System.out.println(poolExecutor.getQueue().size());
TimeUnit.SECONDS.sleep(10);
}
if (integer.get() > pool.num) {
return "success";
}
}
}
return "success";
}
private Double[] getFeature(FaceRecognition face) throws JsonProcessingException {
Short faceFeatureType = face.getFaceFeatureType();
String facePic = face.getFacePic();
if (faceFeatureType == 1) {
facePic = facePic.replace("face-0.jpg", "face-F.jpg");
}
String json = (String) featureStorage.getItem(face.getChannelSerialnum() + "/" + facePic);
Feature feature = objectMapper.readValue(json, Feature.class);
List<Data> datas = feature.getDatas();
if (datas != null && datas.size() > 0) {
Data data = datas.get(0);
Double[] data1 = data.getData();
if (data1.length == 512) {
return data1;
}
}
return null;
}
} }
...@@ -76,7 +76,7 @@ public class FaceRecognition extends BaseModel { ...@@ -76,7 +76,7 @@ public class FaceRecognition extends BaseModel {
/** 图像质量分 **/ /** 图像质量分 **/
private Float faceScore; private Float faceScore;
private Float matchScore;
@Override @Override
public Long getId() { public Long getId() {
...@@ -384,4 +384,11 @@ public class FaceRecognition extends BaseModel { ...@@ -384,4 +384,11 @@ public class FaceRecognition extends BaseModel {
this.trackPath = trackPath; this.trackPath = trackPath;
} }
public Float getMatchScore() {
return matchScore;
}
public void setMatchScore(Float matchScore) {
this.matchScore = matchScore;
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,7 +14,7 @@ import lombok.experimental.Accessors; ...@@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
@Setter @Setter
@Accessors(chain = true) @Accessors(chain = true)
public class Person { public class Person {
private String id;
private Double[] feature; private Double[] feature;
private String personId; private String personId;
} }
...@@ -24,7 +24,7 @@ public class FaceRecognitionRepository { ...@@ -24,7 +24,7 @@ public class FaceRecognitionRepository {
private static final BeanPropertyRowMapper<FaceRecognition> FACE_RECOGNITION_ROW_MAPPER = new BeanPropertyRowMapper<>(FaceRecognition.class); private static final BeanPropertyRowMapper<FaceRecognition> FACE_RECOGNITION_ROW_MAPPER = new BeanPropertyRowMapper<>(FaceRecognition.class);
private static final String QUERY_FACE = "select * from d_face_recognition where countdate=? and mall_id=? and direction=1 and gender>-1 and face_score>0.7"; private static final String QUERY_FACE = "select unid,person_unid,face_feature_type,face_pic,channel_serialnum from d_face_recognition where countdate=? and direction=1 and gender>-1 and face_score>0.7";
private static final String QUERY_FACE_BY_UNID = "select face_pic,id,channel_serialnum,device_serialnum,person_unid,unid,id,countdate,counttime,age,gender,direction,mall_id,account_id,gate_id,face_score,person_type from d_face_recognition where unid in (:unids)"; private static final String QUERY_FACE_BY_UNID = "select face_pic,id,channel_serialnum,device_serialnum,person_unid,unid,id,countdate,counttime,age,gender,direction,mall_id,account_id,gate_id,face_score,person_type from d_face_recognition where unid in (:unids)";
@Resource @Resource
...@@ -34,10 +34,13 @@ public class FaceRecognitionRepository { ...@@ -34,10 +34,13 @@ public class FaceRecognitionRepository {
public List<FaceRecognition> queryFaceRecognitions(Date date, Long mallId) { public List<FaceRecognition> queryFaceRecognitions(Date date, Long mallId) {
return jdbcTemplate.query(QUERY_FACE, FACE_RECOGNITION_ROW_MAPPER, date, mallId); return jdbcTemplate.query(QUERY_FACE, FACE_RECOGNITION_ROW_MAPPER, date);
} }
public List<FaceRecognition> queryFaceRecognitionByUnids(List<String> unidList) { public List<FaceRecognition> queryFaceRecognitionByUnids(List<String> unidList) {
if (unidList == null || unidList.size() == 0) {
return null;
}
Map<String, List<String>> param = Collections.singletonMap("unids", unidList); Map<String, List<String>> param = Collections.singletonMap("unids", unidList);
return namedParameterJdbcTemplate.query(QUERY_FACE_BY_UNID, param, FACE_RECOGNITION_ROW_MAPPER); return namedParameterJdbcTemplate.query(QUERY_FACE_BY_UNID, param, FACE_RECOGNITION_ROW_MAPPER);
} }
......
...@@ -3,6 +3,7 @@ package com.xmh.es.match.service; ...@@ -3,6 +3,7 @@ package com.xmh.es.match.service;
import com.xmh.es.match.entity.MatchResult; import com.xmh.es.match.entity.MatchResult;
import com.xmh.es.match.entity.Person; import com.xmh.es.match.entity.Person;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
...@@ -16,6 +17,7 @@ import org.elasticsearch.client.indices.GetIndexRequest; ...@@ -16,6 +17,7 @@ import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse; import org.elasticsearch.client.indices.GetIndexResponse;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.functionscore.ScriptScoreQueryBuilder; import org.elasticsearch.index.query.functionscore.ScriptScoreQueryBuilder;
import org.elasticsearch.script.Script; import org.elasticsearch.script.Script;
...@@ -125,12 +127,12 @@ public class AlgService { ...@@ -125,12 +127,12 @@ public class AlgService {
SearchRequest searchRequest = new SearchRequest(poolId); SearchRequest searchRequest = new SearchRequest(poolId);
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
builder.fetchSource("personId", null); builder.fetchSource("personId", null);
builder.size(5); builder.size(40);
Map<String, Object> params = new HashMap<>(1); Map<String, Object> params = new HashMap<>(1);
params.put("data", feature); params.put("data", feature);
Script script = new Script( Script script = new Script(
ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG,
"cosineSimilarity(params.data, 'data')", params); "cosineSimilarity(params.data, 'data') + 1", params);
ScriptScoreQueryBuilder queryBuilder = QueryBuilders.scriptScoreQuery(QueryBuilders.matchAllQuery(), script); ScriptScoreQueryBuilder queryBuilder = QueryBuilders.scriptScoreQuery(QueryBuilders.matchAllQuery(), script);
builder.query(queryBuilder); builder.query(queryBuilder);
...@@ -142,8 +144,7 @@ public class AlgService { ...@@ -142,8 +144,7 @@ public class AlgService {
SearchHit[] hits1 = hits.getHits(); SearchHit[] hits1 = hits.getHits();
ArrayList<MatchResult> matchResults = new ArrayList<>(); ArrayList<MatchResult> matchResults = new ArrayList<>();
for (SearchHit item : hits1) { for (SearchHit item : hits1) {
Map<String, Object> sourceAsMap = item.getSourceAsMap(); String personId = item.getId();
String personId = (String) sourceAsMap.get("personId");
float score = item.getScore(); float score = item.getScore();
String index = item.getIndex(); String index = item.getIndex();
MatchResult matchResult = new MatchResult().setPersonId(personId).setScore(score).setPoolId(index); MatchResult matchResult = new MatchResult().setPersonId(personId).setScore(score).setPoolId(index);
...@@ -159,17 +160,22 @@ public class AlgService { ...@@ -159,17 +160,22 @@ public class AlgService {
* @param poolId 特征库名称 * @param poolId 特征库名称
*/ */
public Object addPerson(Person person, String poolId) throws IOException { public Object addPerson(Person person, String poolId) throws IOException {
IndexRequest indexRequest = new IndexRequest(poolId); IndexRequest indexRequest = new IndexRequest(poolId)
indexRequest.id(person.getPersonId()); .id(person.getId())
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder(); .source(XContentType.JSON, "personId", person.getPersonId(), "data", person.getFeature());
xContentBuilder.startObject();
xContentBuilder.field("personId", person.getPersonId());
xContentBuilder.field("data", person.getFeature());
xContentBuilder.endObject();
indexRequest.source(xContentBuilder);
return client.index(indexRequest, RequestOptions.DEFAULT); return client.index(indexRequest, RequestOptions.DEFAULT);
} }
public Object addAllPerson(List<Person> persons, String poolId) throws Exception {
BulkRequest bulkRequest = new BulkRequest();
for (Person person : persons) {
bulkRequest.add(new IndexRequest(poolId)
.id(person.getId())
.source(XContentType.JSON, "personId", person.getPersonId(), "data", person.getFeature()));
}
return client.bulk(bulkRequest, RequestOptions.DEFAULT);
}
/** /**
* 删除人员 * 删除人员
* *
......
...@@ -38,6 +38,12 @@ public class MatchService { ...@@ -38,6 +38,12 @@ public class MatchService {
public List<MatchResult> match(RequestData requestData) throws Exception { public List<MatchResult> match(RequestData requestData) throws Exception {
MultipartFile file = requestData.getFile(); MultipartFile file = requestData.getFile();
Double[] data = extractFeature(file);
Person person = new Person().setFeature(data);
return algService.matchPerson(person, requestData.getPoolId());
}
public Double[] extractFeature(MultipartFile file) throws Exception {
BufferedImage originalImage = ImageIO.read(file.getInputStream()); BufferedImage originalImage = ImageIO.read(file.getInputStream());
BufferedImage jpgImage = Utils.convertImg2Jpg(originalImage); BufferedImage jpgImage = Utils.convertImg2Jpg(originalImage);
...@@ -65,9 +71,7 @@ public class MatchService { ...@@ -65,9 +71,7 @@ public class MatchService {
JSONArray feature = faceFeatureJson.getJSONArray("feature"); JSONArray feature = faceFeatureJson.getJSONArray("feature");
List<Object> objects = feature.toList(); List<Object> objects = feature.toList();
Double[] data = objects.toArray(new Double[]{}); return objects.toArray(new Double[]{});
Person person = new Person().setFeature(data);
return algService.matchPerson(person, requestData.getPoolId());
} }
} }
...@@ -11,4 +11,8 @@ oss.config.bucket=vion-retail ...@@ -11,4 +11,8 @@ oss.config.bucket=vion-retail
# ws # ws
ws.featureUrl=http://101.200.130.13:10000 ws.featureUrl=http://101.200.130.13:10000
# other # other
server.port=12000
\ No newline at end of file \ No newline at end of file
server.port=12000
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
# es
spring.elasticsearch.rest.uris=http://139.217.100.35:9200
\ No newline at end of file \ No newline at end of file
spring: spring:
elasticsearch:
rest:
uris: http://127.0.0.1:9200
profiles: profiles:
active: option active: option
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>hello</title><link href=/static/css/app.e7c2112962ef9f4a39d379467a4bcf3c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.8d9ad72abf44221abb05.js></script><script type=text/javascript src=/static/js/app.975f2cc40df4e4cd82a5.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
webpackJsonp([1],{NHnr:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=a("7+uW"),l={name:"HelloWorld",data:function(){return{formData:new FormData,imageUrl:null,form:{poolId:null,file:null},poolIds:[],poolIdSelected:null,input:null,faceList:null,matchTime:null}},methods:{getSrc:function(t){return"https://vion-retail.oss-cn-beijing.aliyuncs.com/picture/"+t.facePath+t.facePic},beforeupload:function(t){return this.form.file=t,!1},onChange:function(t){this.imageUrl=URL.createObjectURL(t.raw)},onSubmit:function(){var t=this;this.$refs.upload.submit(),this.formData.set("poolId",this.form.poolId),this.formData.set("file",this.form.file),console.log(this.formData),this.axios.post("http://127.0.0.1:12000/alg/match",this.formData,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){var a=e.data.result;if(null!=a){t.faceList=[];for(var o=a.length/5,l=0;l<o;l++){var n=a.slice(5*l,5*l+5);t.faceList.push(n)}}t.matchTime=e.data.time}).catch(function(t){console.error(t)}),this.formData=new FormData},getPoolIds:function(){var t=this;this.axios({method:"get",url:"http://127.0.0.1:12000/alg/poolIds"}).then(function(e){t.poolIds=e.data,t.poolIds.length>0&&(t.form.poolId=t.poolIds[0])}).catch(function(t){console.log(t)})}},mounted:function(){this.getPoolIds()}},n={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"hello",staticStyle:{margin:"auto auto"}},[a("el-form",{ref:"form",staticStyle:{width:"400px",margin:"auto auto"},attrs:{model:t.form}},[a("el-form-item",{attrs:{label:"特征库"}},[a("el-select",{attrs:{placeholder:"请选择特征库"},model:{value:t.form.poolId,callback:function(e){t.$set(t.form,"poolId",e)},expression:"form.poolId"}},t._l(t.poolIds,function(t){return a("el-option",{key:t,attrs:{label:t,value:t}})}),1)],1),t._v(" "),a("el-form-item",{attrs:{label:"人脸图片"}},[a("el-upload",{ref:"upload",staticClass:"avatar-uploader",attrs:{action:"http://127.0.0.1:12000/","show-file-list":!1,"auto-upload":!1,"on-change":t.onChange,"before-upload":t.beforeupload}},[t.imageUrl?a("img",{staticClass:"avatar",attrs:{src:t.imageUrl}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),t._v(" "),a("el-form-item",[a("el-button",{staticStyle:{width:"100%"},attrs:{type:"primary"},on:{click:t.onSubmit}},[t._v("比对")])],1)],1),t._v(" "),null!=t.matchTime?a("p",[t._v("匹配耗时:"+t._s(t.matchTime))]):t._e(),t._v(" "),t._l(t.faceList,function(e,o){return a("el-row",{key:o,staticClass:"row-bg",staticStyle:{width:"80%",margin:"auto"},attrs:{type:"flex",justify:"space-around"}},t._l(t.faceList[o],function(e){return a("el-col",{key:e.unid,attrs:{span:4}},[a("el-card",{staticStyle:{margin:"20px",width:"200px"},attrs:{"body-style":{padding:"0px"}}},[a("img",{staticClass:"image",attrs:{src:t.getSrc(e)}}),t._v(" "),a("div",{staticStyle:{padding:"15px"}},[a("p",{staticStyle:{"font-size":"12px"}},[t._v("匹配分数:"+t._s(e.matchScore))]),t._v(" "),a("p",{staticStyle:{"font-size":"12px"}},[t._v("性别:"+t._s(0==e.gender?"女":1==e.gender?"男":"未知"))]),t._v(" "),a("p",{staticStyle:{"font-size":"12px"}},[t._v("年龄:"+t._s(e.age))]),t._v(" "),a("p",{staticStyle:{"font-size":"12px"}},[t._v("时间:"+t._s(e.counttime))])])])],1)}),1)})],2)},staticRenderFns:[]};var i={name:"App",components:{HelloWorld:a("VU/8")(l,n,!1,function(t){a("fKca")},null,null).exports}},s={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{attrs:{id:"app"}},[e("HelloWorld")],1)},staticRenderFns:[]};var r=a("VU/8")(i,s,!1,function(t){a("m71c")},null,null).exports,c=a("mtWM"),u=a.n(c),f=a("zL8q"),p=a.n(f);a("tvR6");o.default.use(p.a),o.default.config.productionTip=!1,o.default.prototype.axios=u.a,new o.default({el:"#app",components:{App:r},template:"<App/>"})},fKca:function(t,e){},m71c:function(t,e){},tvR6:function(t,e){}},["NHnr"]);
//# sourceMappingURL=app.975f2cc40df4e4cd82a5.js.map
\ No newline at end of file \ No newline at end of file
{"version":3,"sources":["webpack:///src/components/HelloWorld.vue","webpack:///./src/components/HelloWorld.vue?b626","webpack:///./src/components/HelloWorld.vue","webpack:///src/App.vue","webpack:///./src/App.vue?3acb","webpack:///./src/App.vue","webpack:///./src/main.js"],"names":["HelloWorld","name","data","formData","FormData","imageUrl","form","poolId","file","poolIds","poolIdSelected","input","faceList","matchTime","methods","getSrc","item","facePath","facePic","beforeupload","this","onChange","URL","createObjectURL","raw","onSubmit","_this","$refs","submit","set","console","log","axios","post","headers","Content-Type","then","res","result","line","length","i","temp","slice","push","time","catch","err","error","getPoolIds","_this2","method","url","mounted","components_HelloWorld","render","_vm","_h","$createElement","_c","_self","staticClass","staticStyle","margin","ref","width","attrs","model","label","placeholder","value","callback","$$v","$set","expression","_l","key","_v","action","show-file-list","auto-upload","on-change","before-upload","src","type","on","click","_s","_e","index","justify","unid","span","body-style","padding","font-size","matchScore","gender","age","counttime","staticRenderFns","App","components","__webpack_require__","normalizeComponent","ssrContext","selectortype_template_index_0_src_App","id","src_App","App_normalizeComponent","Vue","use","ElementUI","config","productionTip","prototype","Axios","el","template"],"mappings":"qHAoDAA,GACAC,KAAA,aACAC,KAFA,WAGA,OACAC,SAAA,IAAAC,SACAC,SAAA,KACAC,MACAC,OAAA,KACAC,KAAA,MAEAC,WACAC,eAAA,KACAC,MAAA,KACAC,SAAA,KACAC,UAAA,OAGAC,SACAC,OADA,SACAC,GAKA,MAHA,2DACAA,EAAAC,SACAD,EAAAE,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AgB,EAC3BJ,UAAIK,UAAUnF,MAAQoF,IAEtB,IAAIN,WACFO,GAAI,OACJf,YAAcD,OACdiB,SAAU","file":"static/js/app.975f2cc40df4e4cd82a5.js","sourcesContent":["<template>\n <div class=\"hello\" style=\"margin: auto auto\">\n <el-form ref=\"form\" :model=\"form\" style=\"width:400px;margin: auto auto\">\n <el-form-item label=\"特征库\">\n <el-select v-model=\"form.poolId\" placeholder=\"请选择特征库\">\n <el-option v-for=\"item in poolIds\" :key=\"item\" :label=\"item\" :value=\"item\"></el-option>\n </el-select>\n </el-form-item>\n\n <el-form-item label=\"人脸图片\">\n <el-upload\n ref=\"upload\"\n action=\"http://127.0.0.1:12000/\"\n class=\"avatar-uploader\"\n :show-file-list=\"false\"\n :auto-upload=\"false\"\n :on-change=\"onChange\"\n :before-upload=\"beforeupload\"\n >\n <img v-if=\"imageUrl\" :src=\"imageUrl\" class=\"avatar\" />\n <i v-else class=\"el-icon-plus avatar-uploader-icon\"></i>\n </el-upload>\n </el-form-item>\n <el-form-item>\n <el-button style=\"width:100%\" type=\"primary\" @click=\"onSubmit\">比对</el-button>\n </el-form-item>\n </el-form>\n <p v-if=\"matchTime != null\">匹配耗时:{{matchTime}}</p>\n <el-row\n type=\"flex\"\n class=\"row-bg\"\n justify=\"space-around\"\n style=\"width:80%;margin:auto\"\n v-for=\"(value,index) in faceList\"\n :key=\"index\"\n >\n <el-col :span=\"4\" v-for=\"item in faceList[index]\" :key=\"item.unid\">\n <el-card style=\"margin: 20px; width:200px\" :body-style=\"{ padding: '0px'}\">\n <img :src=\"getSrc(item)\" class=\"image\" />\n <div style=\"padding: 15px;\">\n <p style=\"font-size:12px\">匹配分数:{{item.matchScore}}</p>\n <p style=\"font-size:12px\">性别:{{item.gender==0?\"女\":item.gender==1?\"男\":\"未知\"}}</p>\n <p style=\"font-size:12px\">年龄:{{item.age}}</p>\n <p style=\"font-size:12px\">时间:{{item.counttime}}</p>\n </div>\n </el-card>\n </el-col>\n </el-row>\n </div>\n</template>\n\n<script>\nexport default {\n name: \"HelloWorld\",\n data() {\n return {\n formData: new FormData(),\n imageUrl: null,\n form: {\n poolId: null,\n file: null\n },\n poolIds: [],\n poolIdSelected: null,\n input: null,\n faceList: null,\n matchTime:null\n };\n },\n methods: {\n getSrc(item) {\n var src =\n \"https://vion-retail.oss-cn-beijing.aliyuncs.com/picture/\" +\n item.facePath +\n item.facePic;\n return src;\n },\n\n beforeupload(file) {\n this.form.file = file;\n return false;\n },\n onChange(file) {\n this.imageUrl = URL.createObjectURL(file.raw);\n },\n /** ======================axios================================== */\n onSubmit() {\n this.$refs[\"upload\"].submit();\n this.formData.set(\"poolId\", this.form.poolId);\n this.formData.set(\"file\", this.form.file);\n console.log(this.formData);\n\n this.axios\n .post(\n // \"/alg/match\"\n \"http://127.0.0.1:12000/alg/match\"\n , this.formData, {\n headers: {\n \"Content-Type\": \"multipart/form-data\"\n }\n })\n .then(res => {\n var result = res.data.result;\n if (result != null) {\n this.faceList = [];\n\n var line = result.length / 5;\n for (let i = 0; i < line; i++) {\n let temp = result.slice(i * 5, i * 5 + 5);\n this.faceList.push(temp);\n }\n }\n this.matchTime = res.data.time\n })\n .catch(err => {\n console.error(err);\n });\n this.formData = new FormData();\n },\n\n getPoolIds() {\n this.axios({\n method: \"get\",\n url: \"http://127.0.0.1:12000/alg/poolIds\"\n // url: \"/alg/poolIds\"\n })\n .then(res => {\n this.poolIds = res.data;\n if (this.poolIds.length > 0) {\n this.form.poolId = this.poolIds[0];\n }\n })\n .catch(err => {\n console.log(err);\n });\n }\n },\n mounted() {\n this.getPoolIds();\n }\n};\n</script>\n\n<style>\n.hello {\n text-align: center;\n}\n.hello > .el-table .cell {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\na {\n text-decoration: underline;\n /* color: salmon; */\n}\n\na:hover {\n cursor: pointer;\n}\n.avatar-uploader .el-upload {\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.avatar-uploader .el-upload:hover {\n border-color: #409eff;\n}\n.avatar-uploader-icon {\n font-size: 28px;\n color: #8c939d;\n width: 178px;\n height: 178px;\n line-height: 178px;\n text-align: center;\n}\n.avatar {\n width: 178px;\n height: 178px;\n display: block;\n}\n.image {\n width: 100%;\n display: block;\n}\n</style>\n\n\n\n// WEBPACK FOOTER //\n// src/components/HelloWorld.vue","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"hello\",staticStyle:{\"margin\":\"auto auto\"}},[_c('el-form',{ref:\"form\",staticStyle:{\"width\":\"400px\",\"margin\":\"auto auto\"},attrs:{\"model\":_vm.form}},[_c('el-form-item',{attrs:{\"label\":\"特征库\"}},[_c('el-select',{attrs:{\"placeholder\":\"请选择特征库\"},model:{value:(_vm.form.poolId),callback:function ($$v) {_vm.$set(_vm.form, \"poolId\", $$v)},expression:\"form.poolId\"}},_vm._l((_vm.poolIds),function(item){return _c('el-option',{key:item,attrs:{\"label\":item,\"value\":item}})}),1)],1),_vm._v(\" \"),_c('el-form-item',{attrs:{\"label\":\"人脸图片\"}},[_c('el-upload',{ref:\"upload\",staticClass:\"avatar-uploader\",attrs:{\"action\":\"http://127.0.0.1:12000/\",\"show-file-list\":false,\"auto-upload\":false,\"on-change\":_vm.onChange,\"before-upload\":_vm.beforeupload}},[(_vm.imageUrl)?_c('img',{staticClass:\"avatar\",attrs:{\"src\":_vm.imageUrl}}):_c('i',{staticClass:\"el-icon-plus avatar-uploader-icon\"})])],1),_vm._v(\" \"),_c('el-form-item',[_c('el-button',{staticStyle:{\"width\":\"100%\"},attrs:{\"type\":\"primary\"},on:{\"click\":_vm.onSubmit}},[_vm._v(\"比对\")])],1)],1),_vm._v(\" \"),(_vm.matchTime != null)?_c('p',[_vm._v(\"匹配耗时:\"+_vm._s(_vm.matchTime))]):_vm._e(),_vm._v(\" \"),_vm._l((_vm.faceList),function(value,index){return _c('el-row',{key:index,staticClass:\"row-bg\",staticStyle:{\"width\":\"80%\",\"margin\":\"auto\"},attrs:{\"type\":\"flex\",\"justify\":\"space-around\"}},_vm._l((_vm.faceList[index]),function(item){return _c('el-col',{key:item.unid,attrs:{\"span\":4}},[_c('el-card',{staticStyle:{\"margin\":\"20px\",\"width\":\"200px\"},attrs:{\"body-style\":{ padding: '0px'}}},[_c('img',{staticClass:\"image\",attrs:{\"src\":_vm.getSrc(item)}}),_vm._v(\" \"),_c('div',{staticStyle:{\"padding\":\"15px\"}},[_c('p',{staticStyle:{\"font-size\":\"12px\"}},[_vm._v(\"匹配分数:\"+_vm._s(item.matchScore))]),_vm._v(\" \"),_c('p',{staticStyle:{\"font-size\":\"12px\"}},[_vm._v(\"性别:\"+_vm._s(item.gender==0?\"女\":item.gender==1?\"男\":\"未知\"))]),_vm._v(\" \"),_c('p',{staticStyle:{\"font-size\":\"12px\"}},[_vm._v(\"年龄:\"+_vm._s(item.age))]),_vm._v(\" \"),_c('p',{staticStyle:{\"font-size\":\"12px\"}},[_vm._v(\"时间:\"+_vm._s(item.counttime))])])])],1)}),1)})],2)}\nvar staticRenderFns = []\nvar esExports = { render: render, staticRenderFns: staticRenderFns }\nexport default esExports\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/vue-loader/lib/template-compiler?{\"id\":\"data-v-4b4196e0\",\"hasScoped\":false,\"transformToRequire\":{\"video\":[\"src\",\"poster\"],\"source\":\"src\",\"img\":\"src\",\"image\":\"xlink:href\"},\"buble\":{\"transforms\":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/HelloWorld.vue\n// module id = null\n// module chunks = ","function injectStyle (ssrContext) {\n require(\"!!../../node_modules/extract-text-webpack-plugin/dist/loader.js?{\\\"omit\\\":1,\\\"remove\\\":true}!vue-style-loader!css-loader?{\\\"sourceMap\\\":true}!../../node_modules/vue-loader/lib/style-compiler/index?{\\\"vue\\\":true,\\\"id\\\":\\\"data-v-4b4196e0\\\",\\\"scoped\\\":false,\\\"hasInlineConfig\\\":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./HelloWorld.vue\")\n}\nvar normalizeComponent = require(\"!../../node_modules/vue-loader/lib/component-normalizer\")\n/* script */\nexport * from \"!!babel-loader!../../node_modules/vue-loader/lib/selector?type=script&index=0!./HelloWorld.vue\"\nimport __vue_script__ from \"!!babel-loader!../../node_modules/vue-loader/lib/selector?type=script&index=0!./HelloWorld.vue\"\n/* template */\nimport __vue_template__ from \"!!../../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-4b4196e0\\\",\\\"hasScoped\\\":false,\\\"transformToRequire\\\":{\\\"video\\\":[\\\"src\\\",\\\"poster\\\"],\\\"source\\\":\\\"src\\\",\\\"img\\\":\\\"src\\\",\\\"image\\\":\\\"xlink:href\\\"},\\\"buble\\\":{\\\"transforms\\\":{}}}!../../node_modules/vue-loader/lib/selector?type=template&index=0!./HelloWorld.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = null\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __vue_script__,\n __vue_template__,\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\nexport default Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/HelloWorld.vue\n// module id = null\n// module chunks = ","<template>\n <div id=\"app\">\n <HelloWorld/>\n </div>\n</template>\n\n<script>\n import HelloWorld from \"./components/HelloWorld\";\n\n export default {\n name: \"App\",\n components: {\n HelloWorld\n }\n };\n</script>\n\n<style>\n</style>\n\n\n\n// WEBPACK FOOTER //\n// src/App.vue","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"app\"}},[_c('HelloWorld')],1)}\nvar staticRenderFns = []\nvar esExports = { render: render, staticRenderFns: staticRenderFns }\nexport default esExports\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/vue-loader/lib/template-compiler?{\"id\":\"data-v-5a0fcd8c\",\"hasScoped\":false,\"transformToRequire\":{\"video\":[\"src\",\"poster\"],\"source\":\"src\",\"img\":\"src\",\"image\":\"xlink:href\"},\"buble\":{\"transforms\":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/App.vue\n// module id = null\n// module chunks = ","function injectStyle (ssrContext) {\n require(\"!!../node_modules/extract-text-webpack-plugin/dist/loader.js?{\\\"omit\\\":1,\\\"remove\\\":true}!vue-style-loader!css-loader?{\\\"sourceMap\\\":true}!../node_modules/vue-loader/lib/style-compiler/index?{\\\"vue\\\":true,\\\"id\\\":\\\"data-v-5a0fcd8c\\\",\\\"scoped\\\":false,\\\"hasInlineConfig\\\":false}!../node_modules/vue-loader/lib/selector?type=styles&index=0!./App.vue\")\n}\nvar normalizeComponent = require(\"!../node_modules/vue-loader/lib/component-normalizer\")\n/* script */\nexport * from \"!!babel-loader!../node_modules/vue-loader/lib/selector?type=script&index=0!./App.vue\"\nimport __vue_script__ from \"!!babel-loader!../node_modules/vue-loader/lib/selector?type=script&index=0!./App.vue\"\n/* template */\nimport __vue_template__ from \"!!../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-5a0fcd8c\\\",\\\"hasScoped\\\":false,\\\"transformToRequire\\\":{\\\"video\\\":[\\\"src\\\",\\\"poster\\\"],\\\"source\\\":\\\"src\\\",\\\"img\\\":\\\"src\\\",\\\"image\\\":\\\"xlink:href\\\"},\\\"buble\\\":{\\\"transforms\\\":{}}}!../node_modules/vue-loader/lib/selector?type=template&index=0!./App.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = null\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __vue_script__,\n __vue_template__,\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\nexport default Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/App.vue\n// module id = null\n// module chunks = ","// The Vue build version to load with the `import` command\n// (runtime-only or standalone) has been set in webpack.base.conf with an alias.\nimport Vue from 'vue'\nimport App from './App'\nimport Axios from 'axios'\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-chalk/index.css';\n\nVue.use(ElementUI)\nVue.config.productionTip = false\nVue.prototype.axios = Axios\n/* eslint-disable no-new */\nnew Vue({\n el: '#app',\n components: { App },\n template: '<App/>'\n})\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js"],"sourceRoot":""}
\ No newline at end of file \ No newline at end of file
!function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a<e.length;a++)i=e[a],o[i]&&l.push(o[i][0]),o[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(n&&n(e,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=t(t.s=c[a]);return p};var e={},o={2:0};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},t.p="/",t.oe=function(r){throw console.error(r),r}}([]);
//# sourceMappingURL=manifest.2ae2e69a05c33dfc65f8.js.map
\ No newline at end of file \ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap d2d68e467296ba9c478b"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,IAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap d2d68e467296ba9c478b"],"sourceRoot":""}
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -21,6 +21,10 @@ import java.text.ParseException; ...@@ -21,6 +21,10 @@ import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* . * .
...@@ -33,6 +37,9 @@ import java.util.UUID; ...@@ -33,6 +37,9 @@ import java.util.UUID;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class Test0 { public class Test0 {
private final ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(20, 30, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.CallerRunsPolicy());
private final AtomicInteger integer = new AtomicInteger();
private final PoolEnum pool = PoolEnum.POOL_50W;
@Resource @Resource
ObjectMapper objectMapper; ObjectMapper objectMapper;
@Resource @Resource
...@@ -44,14 +51,14 @@ public class Test0 { ...@@ -44,14 +51,14 @@ public class Test0 {
@Test @Test
public void createPoolTest() throws IOException { public void createPoolTest() throws IOException {
Object test2 = algService.createPool(XmhTestApplication.POOL_NAME); Object test2 = algService.createPool(pool.name);
System.out.println(test2); System.out.println(test2);
} }
@Test @Test
public void deleteIndexTest() throws IOException { public void deleteIndexTest() throws IOException {
algService.deletePool(XmhTestApplication.POOL_NAME); algService.deletePool(pool.name);
} }
@Test @Test
...@@ -65,41 +72,61 @@ public class Test0 { ...@@ -65,41 +72,61 @@ public class Test0 {
@Test @Test
public void addPersonTest() throws IOException { public void addPersonTest() throws IOException {
Person person1 = getPerson("3"); Person person1 = getPerson("3");
Object test2 = algService.addPerson(person1, XmhTestApplication.POOL_NAME); Object test2 = algService.addPerson(person1, pool.name);
System.out.println(objectMapper.writeValueAsString(test2)); System.out.println(objectMapper.writeValueAsString(test2));
} }
@Test @Test
public void matchPersonTest() throws Exception { public void matchPersonTest() throws Exception {
Person person = getPerson("3"); Person person = getPerson("3");
List<MatchResult> test2 = algService.matchPerson(person, XmhTestApplication.POOL_NAME); List<MatchResult> test2 = algService.matchPerson(person, pool.name);
System.out.println(objectMapper.writeValueAsString(test2)); System.out.println(objectMapper.writeValueAsString(test2));
} }
@Test @Test
public void batchAdd() throws ParseException { public void batchAdd() throws ParseException, IOException, InterruptedException {
Date start = DateUtil.parse(DateUtil.FORMAT_SHORT, "2020-10-01"); algService.deletePool(pool.name);
Date end = DateUtil.parse(DateUtil.FORMAT_SHORT, "2020-11-19"); algService.createPool(pool.name);
Date start = DateUtil.parse(DateUtil.FORMAT_SHORT, "2020-11-01");
Date end = DateUtil.parse(DateUtil.FORMAT_SHORT, "2020-11-24");
int i = 0;
List<Date> days = DateUtil.getDaysBetweenDates(start, end); List<Date> days = DateUtil.getDaysBetweenDates(start, end);
for (Date day : days) { for (Date day : days) {
List<FaceRecognition> faceRecognitions = faceRecognitionRepository.queryFaceRecognitions(day, 2L); List<FaceRecognition> faceRecognitions = faceRecognitionRepository.queryFaceRecognitions(day, 2L);
for (FaceRecognition faceRecognition : faceRecognitions) { for (FaceRecognition faceRecognition : faceRecognitions) {
try { poolExecutor.execute(() -> {
Double[] feature = getFeature(faceRecognition); try {
if (feature == null) { if (integer.get() >= pool.num) {
continue; return;
}
Double[] feature = getFeature(faceRecognition);
if (feature == null) {
return;
}
Person person = new Person();
person.setPersonId(faceRecognition.getPersonUnid());
person.setFeature(feature);
person.setId(faceRecognition.getUnid());
Object o = algService.addPerson(person, pool.name);
System.out.println(objectMapper.writeValueAsString(o));
integer.addAndGet(1);
} catch (Exception e) {
e.printStackTrace();
} }
Person person = new Person(); });
person.setPersonId(faceRecognition.getUnid()); if (integer.get() > pool.num) {
person.setFeature(feature); return;
Object o = algService.addPerson(person, XmhTestApplication.POOL_NAME); }
System.out.println(objectMapper.writeValueAsString(o)); while (poolExecutor.getQueue().size() > 1000) {
System.out.println(poolExecutor.getQueue().size());
} catch (Exception e) { TimeUnit.SECONDS.sleep(10);
e.printStackTrace(); }
if (integer.get() > pool.num) {
return;
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!