ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

Slow at conv2, why? #327

Closed faust21 closed 2 years ago

faust21 commented 2 years ago

Hi, I'm running the code in mac M1 book, I found that most of the times was spent at conv2, why and how to improve this?

init=0
convert data=2.57908
conv_head=68.5943
conv0=71.032
pool0=1.12742
conv1=88.0388
conv2=265.259
pool3=1.17971
conv3=65.2779
pool4=0.25425
conv4=16.0848
pool5=0.0647917
conv5=3.82154
pool6=0.0168333
conv6=0.933292
branch3=59.9363
branch4=12.6166
branch5=2.89946
branch6=0.816958
prior3=0.0800833
prior4=0.0170417
prior5=0.00320833
prior6=0.00129167
prior flat=0.342042
concat prior=0.0728333
softmax=0.144583
detection output=0.0440417
copy result=0.00129167
fengyuentau commented 2 years ago

Most of the time is taken by the first few conv layers due to the size of feature maps. As feature maps are gradually downsampled, later conv layers do not take so much time even though they have more channels.