0 purchases
quake tensorflow face rec
夸克tensorFlow人脸识别插件 #
夸克tensorFlow人脸识别插件
依赖: #
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation('org.tensorflow:tensorflow-lite:0.0.0-nightly') { changing = true }
//noinspection GradleCompatible
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'com.google.truth:truth:1.0.1'
// added MLKit dependencies for face detector
//添加google机器学习人脸检测依赖包
implementation 'com.google.mlkit:face-detection:16.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
//沉浸式状态栏
// 基础依赖包,必须要依赖
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
copied to clipboard
SDK: #
compileSdkVersion 30
minSdkVersion 21
copied to clipboard
权限: #
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
copied to clipboard
使用方法: #
1. 创建sqlite数据库和表 #
表结构:
// 创建人脸会员表
NSString *sql1 = @"CREATE TABLE IF NOT EXISTS faceVIP ("
"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
"FaceID VARCHAR(50) NOT NULL,"
"FaceFeature TEXT NULL,"
"PhoneNum VARCHAR(100) NULL,"
"Profile INTEGER NOT NULL)";
copied to clipboard
2. 调用Android原生方法 #
跳转到人脸识别界面:String jumpToFaceRec( String signInOrOut,String workerId,String tfFaceFeature )
参数
类型
说明
signInOrOut
String
判断标识,签到(signIn)/签退(signOut)
workerFaceData
String
人脸数据
worker_id
String
人脸ID
tfFaceFeature
String
人脸特征值
事例
{
"signInOrOut":"SignIn",
"workerFaceData": [
{
"worker_id": "1103",
"tfFaceFeature": "[[-0.01868044,0.007812505,-0.0052591884,0.017184291,-0.0005014571,-0.04965949,0.029967971,0.15349059,-0.053747255,0.08329308,0.00912636,0.0046349885,0.011018953,-0.00039755026,-0.002642632,-0.08705466,-0.008084089,0.012478068,0.004755481,-0.009648986,0.009415537,-0.0015480589,-0.11201987,-0.00087366917,0.054474264,0.004059401,-0.0044406955,-0.0062978957,-0.024297472,-0.04813296,0.0050540534,0.12896268,0.023602508,-0.0028803032,0.04289934,0.03179192,-0.07009779,0.0077348067,0.0037648631,-0.27267113,-0.003608972,-0.0010515945,-0.010447709,0.012209092,0.000797089,0.04600996,-0.07764051,0.107896656,0.0016931049,-0.03810363,0.27371597,0.003213465,-0.079054505,0.0031518284,0.124618895,0.011195188,-0.105581164,0.0011454014,0.019570464,-0.004775963,0.019086355,0.07967502,-0.121886514,0.25350982,0.00023018163,0.10271993,-0.0023822682,-0.0027765585,0.0011481016,-0.0014262407,0.00043497843,-0.2104037,0.27965355,-0.013651227,-0.1031086,0.0007156794,-0.0031996875,0.0008730604,-0.14880206,0.014937073,0.011353092,0.014501895,-0.0065275836,0.019808568,-0.050790466,0.0036852078,0.015510053,0.24633428,0.038194813,-0.13241394,-0.050475836,0.00033103913,-0.0011533333,0.015483913,-0.21180321,-0.048339013,-0.040152818,-0.049467575,0.0005469461,-0.010648281,-0.0015942047,0.004785429,0.0023586985,0.0014409437,0.0062932107,0.0023616313,0.028117005,0.0025239778,0.010791096,-0.0055007813,-0.08203446,0.0018110019,0.010295376,0.1029968,0.001459361,-0.08075291,0.0027705778,-0.014496666,0.21282725,-0.0656544,-0.06626789,-0.020488258,-0.14761117,0.0012798345,0.0019482647,0.0062801433,0.006889822,-0.009904385,0.008737684,-0.015515512,0.0053167986,-0.00026015707,-0.00075457676,0.008163415,0.04626295,0.00022109316,-0.07476579,-0.10362371,-0.006013145,-0.009265384,0.007610806,-0.0048214523,-0.003316277,0.114775285,0.026422862,0.11494978,-0.009122699,-0.0018228391,-0.008262212,0.0028293538,0.0017020118,-0.011170498,0.19718307,-0.0047476776,0.00045479918,-0.0005824578,0.00783276,-0.014085121,-0.11133799,-0.0022158506,0.004012702,0.0027769108,0.0058411546,-0.0029568907,0.004984257,0.00824909,0.012343966,-0.07045259,0.0021965662,0.0010454953,-0.18452723,-0.044295672,0.002848347,0.008592696,-0.0068043955,-0.0056602284,-0.08085304,0.00609998,-0.004155458,0.0054296907,-0.09763085,-0.043889347,-0.0017659487,-0.003324242,-0.18701719,0.024586983,-0.08941396,0.03424759,-0.112050176,0.013452722,-0.011692863,-0.011305992]]"
},
{
"worker_id": "1104",
"tfFaceFeature": "[[-0.14350058138370514, 0.1078503355383873, -0.004657670855522156, -0.05975769832730293, -0.05960648134350777, -0.044779762625694275, -0.06390273571014404, -0.15250790119171143, 0.06926396489143372, -0.0564093254506588, 0.23395469784736633, -0.056720294058322906, -0.1579742580652237, -0.13758882880210876, -0.03232746571302414, 0.15290507674217224, -0.15960119664669037, -0.1065082773566246, -0.04201551526784897, -0.053293269127607346, 0.1030949056148529, 0.015350257977843285, -0.00795884057879448, 0.06006740778684616, -0.06209242343902588, -0.33922675251960754, -0.08499790728092194, -0.0663110762834549, 0.07897689193487167, -0.05105077102780342, -0.0350806899368763, -0.014884542673826218, -0.23291799426078796, -0.10737714916467667, 0.05463956668972969, 0.06962849944829941, -0.040922634303569794, -0.05898190289735794, 0.1496339738368988, -0.03293885290622711, -0.17047880589962006, 0.037061236798763275, 0.12307049334049225, 0.25998181104660034, 0.20632529258728027, 0.06892731785774231, 0.0026313508860766888, -0.12765298783779144, 0.09250334650278091, -0.11931072175502777, 0.028396714478731155, 0.13562560081481934, 0.09461446106433868, 0.0778050646185875, 0.014100543223321438, -0.12716440856456757, 0.04378762096166611, 0.09837730973958969, -0.1735524833202362, 0.025433026254177094, 0.08220037072896957, -0.07226114720106125, -0.028256069868803024, -0.0753258466720581, 0.252644419670105, 0.029939331114292145, -0.131501242518425, -0.16636553406715393, 0.13564994931221008, -0.10314525663852692, -0.04550720378756523, 0.03973875567317009, -0.14315281808376312, -0.19514954090118408, -0.2825012505054474, 0.09841077774763107, 0.36831510066986084, 0.13358213007450104, -0.1700563281774521, 0.07984152436256409, -0.038504358381032944, -0.00814746879041195, 0.14558936655521393, 0.1374904364347458, 0.0144827701151371, -0.03113263100385666, -0.040294960141181946, 0.030583824962377548, 0.17230921983718872, -0.02575289085507393, -0.03858082741498947, 0.18884003162384033, -0.034976713359355927, 0.0429825596511364, 0.014559542760252953, 0.06637340784072876, -0.1126251220703125, 0.07733730971813202, -0.11530797928571701, -0.0016036145389080048, 0.049398552626371384, -0.030105149373412132, 0.05625452101230621, 0.14135140180587769, -0.11795134097337723, 0.12083422392606735, 0.011886876076459885, 0.044985320419073105, 0.01627098023891449, -0.015591993927955627, -0.08176986128091812, -0.06218818947672844, 0.06294252723455429, -0.23972930014133453, 0.2850410044193268, 0.17688386142253876, 0.07630788534879684, 0.12514379620552063, 0.12403734773397446, 0.06877363473176956, 0.058838363736867905, -0.00432233139872551, -0.20031693577766418, -0.027797004207968712, 0.08945595473051071, -0.046497054398059845, 0.09633969515562057, 0.0018555708229541779], [-0.10489009320735931, 0.024258393794298172, 0.02048499695956707, -0.1047137975692749, -0.05106231942772865, -0.038390111178159714, -0.06483391672372818, -0.13122066855430603, 0.06734957545995712, -0.10047248005867004, 0.2585979998111725, -0.09823185205459595, -0.1651199758052826, -0.1364780068397522, -0.06366196274757385, 0.18091830611228943, -0.2082003951072693, -0.09032437205314636, -0.031958386301994324, -0.014117840677499771, 0.07247021794319153, -0.022005215287208557, -0.030097631737589836, 0.05425079166889191, -0.06271842122077942, -0.33510294556617737, -0.10604360699653625, -0.047899164259433746, 0.08858820796012878, -0.05322257801890373, -0.026329029351472855, 0.01863190159201622, -0.2253163903951645, -0.0677979588508606, 0.007705039344727993, 0.039014868438243866, -0.01878911815583706, -0.08643721789121628, 0.15794715285301208, -0.027613762766122818, -0.17520679533481598, 0.016485091298818588, 0.09331154823303223, 0.2406175434589386, 0.1813526749610901, 0.07017835229635239, 0.005888381972908974, -0.13326430320739746, 0.14136484265327454, -0.1795014590024948, 0.0020530298352241516, 0.10086928308010101, 0.07464559376239777, 0.03926091641187668, -0.021674595773220062, -0.11623752117156982, 0.059522680938243866, 0.15787304937839508, -0.18920807540416718, 0.057785764336586, 0.07040757685899734, -0.08033572137355804, -0.020416123792529106, -0.08249659091234207, 0.2518391013145447, 0.06846053898334503, -0.12471362203359604, -0.1558140218257904, 0.18414564430713654, -0.09796682000160217, -0.029267869889736176, 0.013941369950771332, -0.11373744159936905, -0.17815794050693512, -0.3004700839519501, 0.024978842586278915, 0.3693740665912628, 0.14489410817623138, -0.1845758855342865, 0.0701223686337471, -0.05790204554796219, 0.011891720816493034, 0.18518903851509094, 0.1297311782836914, -0.02105475589632988, -0.01778039149940014, -0.08188003301620483, 0.002163487486541271, 0.19148144125938416, -0.0171947218477726, -0.004369752481579781, 0.20504894852638245, -0.0158033836632967, 0.0605030357837677, 0.020161237567663193, 0.02387484908103943, -0.12655241787433624, 0.051032137125730515, -0.1373526155948639, -0.013528057374060154, 0.045559197664260864, -0.0005161762237548828, 0.06643591821193695, 0.16078653931617737, -0.09673946350812912, 0.16894753277301788, 0.007386249490082264, 0.050817351788282394, 0.049852486699819565, -0.017508557066321373, -0.036603618413209915, -0.05669281259179115, 0.06884144246578217, -0.1980012208223343, 0.18932807445526123, 0.14060503244400024, 0.10272780060768127, 0.1275634467601776, 0.13898590207099915, 0.0905223935842514, -0.011560001410543919, -0.023254062980413437, -0.24124467372894287, 0.0022444818168878555, 0.09488322585821152, -0.06175384297966957, 0.12961530685424805, -0.0003334418870508671]]"
}
]
}
copied to clipboard
返回内容
{
"id":"",
"signInOrOut":"SignIn",
"facePicUrl":"",
"log":"\n\n结果:\n5帧里陌生人匹配到5帧\n",
"faceFeature":"[[-0.008751192, 0.0030202484, -0.012142694, 0.008064498, -0.0032106566, -0.10088397, 0.022745172, 0.15712303, -0.08237792, 0.13241206, 0.011892387, -0.0021597883, 0.010355831, -0.0032959005, -0.0024689536, -0.14141938, -0.008483222, 0.011521982, 0.0064745145, -0.005759604, -0.008408178, -0.0076640095, -0.08311933, 0.0029512255, 0.14313698, -0.007692932, -0.0015752659, -0.039180834, 0.043464802, 0.049718738, 0.01061034, 0.12223226, 0.14185165, -0.0034577814, 0.13974974, -0.035920892, -0.048121527, 0.015394894, -8.94153E-4, -0.021783143, -0.003063411, -0.0011778879, -0.00908877, 0.008577126, 0.009608789, 0.080498956, 0.0068448437, 0.18244676, -0.0034980248, -0.022942197, 0.10771534, 4.068308E-4, -0.12314866, 8.6295063E-4, 0.09720795, 0.0014791933, 0.037730075, 0.0011833013, 0.015216509, -0.008578452, -4.0508492E-4, 0.08227055, -0.07701273, 0.19879182, 0.0066302274, 0.12444461, -0.004993223, -0.01993386, 0.0044099325, -3.2235336E-4, 0.0035031864, -0.3148847, 0.30309716, -0.0063782753, -0.06926931, -1.298429E-4, -0.008203556, 0.0015328304, -0.16128798, -0.02257527, 8.3492935E-4, -0.0064128283, -0.0038262936, 0.13101919, -0.0060613262, 0.0010740443, 0.005416932, 0.1406614, -0.045120794, 0.10148759, -0.08596581, 0.0049291416, 0.0023064984, -7.263122E-4, -0.19451232, 0.11345557, 0.029701276, -0.031694744, -0.002377842, 0.0026213117, -5.350538E-4, 0.0020563, -0.0054276627, -3.0616537E-4, 0.015427064, 0.0037418625, 0.0075437743, 0.0046805777, 6.9766317E-4, 0.008066668, -0.012650778, 0.005144567, 0.008325037, 0.17213933, -0.003152059, -0.14782989, 0.016044632, -0.010664162, 0.23192707, -0.046807304, -0.06824358, -0.0458375, -0.05999119, 0.002810394, 0.0027989428, 0.008333594, 0.009836853, -0.007726485, 3.131237E-4, 0.09757385, 0.0017332282, 0.0031282997, -0.004601523, 0.050573114, 0.015647318, -0.00699634, -0.060013007, -0.12783349, -0.010604098, -0.007899491, 0.0025910353, -0.0051525314, -0.005615167, -0.10900332, -0.13414702, 0.03077083, -0.011020182, 0.0047441595, -0.001166168, 0.0071230032, -0.0034031235, -0.12707235, 0.023864884, -0.0057265023, 0.0073658237, 0.0010447296, 0.010785962, -0.005117901, -0.12095976, -0.0037111843, 0.004095217, 0.0050687212, 0.007559834, -0.008354545, 0.0074513946, 0.008290464, 0.0037448974, 0.10893786, 0.004889087, 0.0010725535, -0.0036997418, -0.062126495, 0.0016028188, 0.0633276, -0.010374747, -0.008538342, -0.009471571, 0.023007818, -0.0021869107, -0.004102411, -0.054200485, -0.029808749, -0.004346112, -0.0041573066, -0.19853769, 0.25992683, 0.018096337, -0.008681233, 0.032144453, -0.025189253, 0.004749334, -0.008277817]]
}
copied to clipboard
返回字段
返回字段
类型
说明
worker_id
String
识别结果:员工ID
signInOrOut
String
签到签退标识
facePicUrl
String
人脸头像
log
String
人脸识别结果以日志形式打印
faceFeature
String
当前使用者人脸特征值
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.