update retinafaceAntiCov

This commit is contained in:
wang-xinyu 2020-06-16 21:10:55 +08:00
parent 5273421dda
commit 3132903d91
3 changed files with 26 additions and 3 deletions

View File

@ -27,7 +27,7 @@ sudo ./retinafaceAntiCov -s // build and serialize model to file i.e. 'retinafa
wget http://www.kaixian.tv/gd/d/file/201611/07/23efff3a26e2385620e719378c654fb1.jpg -O test.jpg
sudo ./retinafaceAntiCov -d // deserialize model file and run inference.
3. check the images generated, as follows. out.jpg
3. check the image generated, as follows 'out.jpg'
```
<p align="center">

View File

@ -0,0 +1,23 @@
import struct
from retinaface_cov import RetinaFaceCoV
gpuid = 0
model = RetinaFaceCoV('./cov2/mnet_cov2', 0, gpuid, 'net3l')
f = open('retinafaceAntiCov.wts', 'w')
f.write('{}\n'.format(len(model.model.get_params()[0].keys()) + len(model.model.get_params()[1].keys())))
for k, v in model.model.get_params()[0].items():
vr = v.reshape(-1).asnumpy()
f.write('{} {} '.format(k, len(vr)))
for vv in vr:
f.write(' ')
f.write(struct.pack('>f',float(vv)).hex())
f.write('\n')
for k, v in model.model.get_params()[1].items():
vr = v.reshape(-1).asnumpy()
f.write('{} {} '.format(k, len(vr)))
for vv in vr:
f.write(' ')
f.write(struct.pack('>f',float(vv)).hex())
f.write('\n')

View File

@ -29,8 +29,8 @@
using namespace nvinfer1;
// stuff we know about the network and the input/output blobs
static const int INPUT_H = 640;
static const int INPUT_W = 640;
static const int INPUT_H = decodeplugin::INPUT_H;
static const int INPUT_W = decodeplugin::INPUT_W;
static const int DETECTION_SIZE = sizeof(decodeplugin::Detection) / sizeof(float);
static const int OUTPUT_SIZE = (INPUT_H / 8 * INPUT_W / 8 + INPUT_H / 16 * INPUT_W / 16 + INPUT_H / 32 * INPUT_W / 32) * 2 * DETECTION_SIZE + 1;
const char* INPUT_BLOB_NAME = "data";