diff --git a/retinafaceAntiCov/README.md b/retinafaceAntiCov/README.md index 4b5d3e8..6290f8d 100644 --- a/retinafaceAntiCov/README.md +++ b/retinafaceAntiCov/README.md @@ -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' ```

diff --git a/retinafaceAntiCov/gen_wts.py b/retinafaceAntiCov/gen_wts.py new file mode 100644 index 0000000..d798ff0 --- /dev/null +++ b/retinafaceAntiCov/gen_wts.py @@ -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') + diff --git a/retinafaceAntiCov/retinafaceAntiCov.cpp b/retinafaceAntiCov/retinafaceAntiCov.cpp index 509b262..299a3d1 100644 --- a/retinafaceAntiCov/retinafaceAntiCov.cpp +++ b/retinafaceAntiCov/retinafaceAntiCov.cpp @@ -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";