In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to analyze the mobile SOTA model MixNet, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
1. Preface
Depthwise convolution is often used in designing lighter and more efficient networks, but the convolution kernel size in Depthwise convolution is usually ignored (usually using 3x3). We study the influence of convolution kernels of different sizes on the performance of the network, and observe that the combination of convolution cores of different sizes can achieve higher accuracy. Based on this idea, we get a convolution module composed of convolution kernels of different sizes into Depthwise. Under the search of AutoML, we propose a more efficient network Mixnet, which surpasses most mobile networks such as Mobilenetv1, v2, shufflenet and so on.
two。 Research motivation
Because Depthwise convolution is to separate each channel, do a separate convolution operation. Therefore, in the design of the network, in order to reduce the amount of computation, researchers usually focus on how to control the number of channels, so that the amount of network computation will not increase too much. Then the convolution of 3x3 size convolution kernels is usually used in the network, and other work shows that large convolution kernels can improve the model performance to some extent. Our question is whether switching to large convolution kernels will necessarily improve the accuracy of the model.
Figure 1
By comparing the two network structures, we can see that the best performance of different networks corresponds to different convolution kernel sizes.
Based on the observed results, we set up a MixConv module composed of convolution kernels of different sizes.
Figure 23. MixConv design strategy
There are still many parameters of the MixConv module that have not been actually determined.
3.1 number of Groups groups
MixConv requires grouping channels and assigning them to convolution cores of different sizes. In the experiment, the researchers found that when Groups = 4, the structure of MobileNets is the most stable. With the help of NAS search, the researchers searched the structure from 1 to 5 groups.
3.2 KernelSize convolution kernel size
Although the convolution kernel size can be designed at will, there is still a certain premise. For example, when the convolution kernels of two groups are of the same size, it can be equivalent to the fact that the two groups are fused into a convolution group (for example, both groups are 3x3 convolution kernels and the output channel is X, which is equivalent to a group of 3x3 convolution kernels and output channel X).
So we set the initial size of convolution kernel to be 3 and the growth of convolution kernel between groups to be 2.
For example, if it is divided into four groups, the convolution core is 3x3 5x5 7x7 9x9.
3.3.The number of channels of convolution per group of ChannelSize
We adopted two strategies.
Equal division, assuming that there are four groups, the number of channels is 128, then the number of channels in each group is 32 exponential growth division, with 2 as the base exponential growth, assuming that there are four groups, the number of channels is 32, then the number of channels in each group is 16, 8, 4, 4 (the number of channels in the last group, usually the remainder) 3.4 whether DilatedConv uses hole convolution
Hole convolution tends to get a larger receptive field, and it can reduce the number of parameters to a certain extent compared with the large convolution kernel of the same receptive field. however, according to our experiments, the performance of hole convolution is usually worse than that of large convolution kernel.
Figure 3
The figure above is a further verification of various strategies of Mixconv based on Mobilenet structure.
3.5 Mixnet overall Architectur
After introducing the previous design concept, this paper is almost done. The follow-up work is all obtained by AutoML search. Mixnet has three sizes of models (MixNet-S, MixNet-M, MixNet-L).
The following two pictures show the structure of Mixnet-S and Mixnet-M, respectively.
The structure of Mixnet-S the structure of MixNet-M. Related code implementation
The https://github.com/romulus0914/MixNet-PyTorch code is used here, which explains the DepthwiseConv modules of different kernel_size proposed by the researchers.
4.1 MDConvclass MDConv (nn.Module):
"
Implement separate depthwise convolution
"
Def _ _ init__ (self, channels, kernel_size, stride):
Super (MDConv, self). _ _ init__ ()
Self.num_groups = len (kernel_size)
Self.split_channels = _ SplitChannels (channels, self.num_groups)
Self.mixed_depthwise_conv = nn.ModuleList ()
For i in range (self.num_groups):
Self.mixed_depthwise_conv.append (nn.Conv2d (
Self.split_channels [i], self.split_ channels[i]
Kernel_size [i], stride=stride, padding=kernel_ size[i] / / 2
Groups=self.split_ channels[i]
Bias=False
))
Def forward (self, x):
If self.num_groups = = 1:
Return self.mixed_depthwise_conv [0] (x)
X_split = torch.split (x, self.split_channels, dim=1)
X = [conv (t) for conv, t in zip (self.mixed_depthwise_conv, x_split)]
X = torch.cat (x, dim=1)
Return x
First of all, the number of channels corresponding to each kernel size is obtained by the method of splitchannels.
Then use a for loop to add the convolution module of each different kernel size to the ModuleList container
In forward propagation, the input is separated in the channel dimension by calling the torch.split method, and all the tensors obtained by convolution are saved through a list. Finally, call torch.cat to link on the channel dimension.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.