update:添加无人脸图片的测试用例

This commit is contained in:
divenswu 2022-11-24 12:50:55 +08:00
parent 2754ce7703
commit c7cfd43c5c
27 changed files with 110 additions and 6 deletions

View File

@ -0,0 +1,23 @@
package com.visual.face.search.server.controller.server.api;
import com.visual.face.search.server.domain.common.ResponseInfo;
import java.util.List;
import java.util.Map;
public interface AdminControllerApi {
/**
*获取命名空间集合列表
* @return 命名空间列表
*/
public ResponseInfo<List<String>> getNamespaceList();
/**
*根据命名空间查看集合列表
* @param namespace 命名空间
* @return 集合列表
*/
public ResponseInfo<List<Map<String, String>>> getCollectList(String namespace);
}

View File

@ -0,0 +1,21 @@
package com.visual.face.search.server.controller.server.impl;
import com.visual.face.search.server.controller.base.BaseController;
import com.visual.face.search.server.controller.server.api.AdminControllerApi;
import com.visual.face.search.server.domain.common.ResponseInfo;
import java.util.List;
import java.util.Map;
public class AdminControllerImpl extends BaseController implements AdminControllerApi {
@Override
public ResponseInfo<List<String>> getNamespaceList() {
return null;
}
@Override
public ResponseInfo<List<Map<String, String>>> getCollectList(String namespace) {
return null;
}
}

View File

@ -0,0 +1,34 @@
package com.visual.face.search.server.controller.server.restful;
import com.visual.face.search.server.controller.server.impl.AdminControllerImpl;
import com.visual.face.search.server.domain.common.ResponseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Api(tags="06、管理员接口")
@RestController("visualAdminController")
@RequestMapping("/visual/admin")
public class AdminController extends AdminControllerImpl {
@ApiOperation(value="1、获取命名空间集合列表")
@Override
@ResponseBody
@RequestMapping(value = "/getNamespaceList", method = RequestMethod.GET)
public ResponseInfo<List<String>> getNamespaceList() {
return super.getNamespaceList();
}
@ApiOperation(value="2、根据命名空间查看集合列表")
@Override
@ResponseBody
@RequestMapping(value = "/getCollectList", method = RequestMethod.GET)
public ResponseInfo<List<Map<String, String>>> getCollectList(@ApiParam(value = "命名空间", name="namespace", required=true) @RequestParam(value = "namespace", required = true) String namespace) {
return super.getCollectList(namespace);
}
}

View File

@ -0,0 +1,10 @@
package com.visual.face.search.server.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AdminMapper {
}

View File

@ -0,0 +1,5 @@
package com.visual.face.search.server.service.api;
public interface AdminService {
}

View File

@ -0,0 +1,11 @@
package com.visual.face.search.server.service.impl;
import com.visual.face.search.server.service.api.AdminService;
import com.visual.face.search.server.service.base.BaseService;
import org.springframework.stereotype.Service;
@Service("adminCollectService")
public class AdminServiceImpl extends BaseService implements AdminService {
}

View File

@ -23,7 +23,7 @@ public class FaceSearchExample {
//远程测试服务
//public static String serverHost = "http://face-search.diven.nat300.top";
public static String namespace = "namespace_1";
public static String collectionName = "collect_20211201_v10";
public static String collectionName = "collect_20211201_v11";
public static FaceSearch faceSearch = FaceSearch.build(serverHost, namespace, collectionName);
/**集合创建*/
@ -33,7 +33,7 @@ public class FaceSearchExample {
sampleColumns.add(FiledColumn.build().setName("name").setDataType(FiledDataType.STRING).setComment("姓名"));
//人脸属性字段
List<FiledColumn> faceColumns = new ArrayList<>();
faceColumns.add(FiledColumn.build().setName("label").setDataType(FiledDataType.STRING).setComment("标签1"));
// faceColumns.add(FiledColumn.build().setName("label").setDataType(FiledDataType.STRING).setComment("标签1"));
//待创建的人脸库信息
Collect collect = Collect.build().setCollectionComment("人脸库").setSampleColumns(sampleColumns).setFaceColumns(faceColumns);
//删除集合
@ -49,7 +49,7 @@ public class FaceSearchExample {
/**添加样本数据*/
public static void index(){
String indexPath = "face-search-test/src/main/resources/image/validate/index";
String indexPath = "face-search-test/src/main/resources/image/noface";
for(String name : Objects.requireNonNull(new File(indexPath).list())){
System.out.println(name);
File files[] = Paths.get(indexPath, name).toFile().listFiles();
@ -64,7 +64,7 @@ public class FaceSearchExample {
if(createSample.ok()){
for(File image : files){
KeyValues faceData = KeyValues.build();
faceData.add(KeyValue.build("label", "标签-" + name));
// faceData.add(KeyValue.build("label", "标签-" + name));
String imageBase64 = Base64Util.encode(image.getAbsolutePath());
Face face = Face.build(sampleId).setFaceData(faceData).setImageBase64(imageBase64)
.setMinConfidenceThresholdWithThisSample(50f)
@ -122,8 +122,8 @@ public class FaceSearchExample {
/**main**/
public static void main(String[] args) {
collect();
index();
// collect();
// index();
search();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB