SimSwap icon indicating copy to clipboard operation
SimSwap copied to clipboard

Not an issue: changing det-dize / processing speed

Open instant-high opened this issue 4 years ago • 9 comments

I've been playing around with the line

app.prepare(ctx_id= 0, det_thresh=opt.det_thresh, det_size=(640, 640))

in test_video_swapsingle.py

Setting lower values (480, 320, 256, 160) significant increases the processing speed Setting to 256 doubles #it/sec.

It nearly always gives the same results, depending on video resolution and size of the face in the video frame. eg. if your video is 720p height and the face is someting like 256pixel height in it you can use det-size 256 and it is working.

But arcface throws a lot of warnings for every frame: [W:onnxruntime:, execution_frame.cc:721 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {12800,10} does not match actual shape of {3200,10} for output 454

Can this be done a better way?

instant-high avatar Jul 24 '21 11:07 instant-high

Maybe you can try 320*320. And I thought you can go to insightface to ask the author, cause I just use it as a tool to detect face Hhhh.

NNNNAI avatar Jul 24 '21 13:07 NNNNAI

Yes. You have to use all other values as a pair (640,640 or 320,320 or.....) Searched the net so far but couldn't find more information so I asked

instant-high avatar Jul 24 '21 13:07 instant-high

You can create a issue right here insightface, they should be professional enough to solve your problem.

NNNNAI avatar Jul 24 '21 13:07 NNNNAI

You can call onnxruntime.set_default_logger_severity(3) to avoid warning.

nttstar avatar Jul 25 '21 07:07 nttstar

Thank you. That works.

instant-high avatar Jul 25 '21 07:07 instant-high

I've been playing around with the line

app.prepare(ctx_id= 0, det_thresh=opt.det_thresh, det_size=(640, 640))

in test_video_swapsingle.py

Setting lower values (480, 320, 256, 160) significant increases the processing speed Setting to 256 doubles #it/sec.

It nearly always gives the same results, depending on video resolution and size of the face in the video frame. eg. if your video is 720p height and the face is someting like 256pixel height in it you can use det-size 256 and it is working.

But arcface throws a lot of warnings for every frame: [W:onnxruntime:, execution_frame.cc:721 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {12800,10} does not match actual shape of {3200,10} for output 454

Can this be done a better way?

Excuse me but, in which file do you find that value? I'm modifying "face_detect_crop_single.py" but it doesn't change the resolution or the det size. Thanks!

coldplayer12 avatar Jul 29 '21 18:07 coldplayer12

As described above. Change value in test_video_swapsingle.py

instant-high avatar Jul 29 '21 18:07 instant-high

As described above. Change value in test_video_swapsingle.py

So I tried changing from 640 to 320, but still only seeing 1 it/s. My graphics card is a Titan V.

aesanchezgh avatar Feb 13 '22 16:02 aesanchezgh

Got lost trying to figure out where to call it from, can anybody help?

I've only managed to find an import of set_default_logger_severity function in onnxruntime/init.py, but so far I was unable to pinpoint where are the calls to onnxruntime.

Turned out, putting set_default_logger_severity(3) into onnxruntime/init.py works totally fine: warnings're gone.

vladosShikos avatar Feb 18 '22 01:02 vladosShikos