huawei-noah / efficient-ai-backbones Goto Github PK
View Code? Open in Web Editor NEWEfficient AI Backbones including GhostNet, TNT and MLP, developed by Huawei Noah's Ark Lab.
Efficient AI Backbones including GhostNet, TNT and MLP, developed by Huawei Noah's Ark Lab.
Hi, very thanks for your working, @iamhankai
but i have troubles when i using the pre-trained parameters, the result of the end_points['Conv2d_18'] was [[[[0,0,0...,0,0]]]] and the front vectors were allright. could u tell me how to solving this? thanks again!
(tf==1.14.0,python==3.6, tensorpack==0.10.1)
Can I only replace the Conv2d in my net with GhostModule rather than use the GhostNet?
作者您好,首先恭喜这篇工作中了CVPR
我对Ghost模块的理解是,先对原始特征图A做常规的卷积得到特征图B,再对特征图B做分组卷积得到其他特征图C,最后特征图B,C concat到一起进入到下一层
我想的是您文中说的这部分是个线性变换,但是您还是在对特征图B分组卷积后进行了一次Relu激活,加入激活函数不就是打破了线性吗,这不应该是一个线性变换。
望作者能解答一下
Hello, how does the Ghostnet train? Can you provide the source code for the training model? Will you open the training code in future?
Good Work! Thanks for sharing.
Why is the kernel size in primary_conv 1 and this in cheap_operation 3(dw) ? If you have tried setting the kernel size in primary 3 and in cheap_operation 1(dw)? It seems that the latter has less FLOPs. (Although I guess this adjustment may lead to worse behavier.)
Is there a ghostnet caffe model?
converted to darknet2caffe but not working properly in nnie 3519a,3559a.
What should I do if I want to test ghostnet or tinynet in 3519a or 3559a?
Excuse me, why I used your GhostModule, but the video memory increased. I simply experimented, turning a channel number of 64 into a channel number of 128 through convolution, and the program showed increased video memory. Is the number of channels too small to fit, or the number of ghostmodules is not enough, thank you for your answer.
ghostnet在 resnet50中的那个实验,是怎么把ghost module结合进去的呀,cheap conv用的是depth conv吗
the crnn repo i used:https://github.com/Sierkinhane/crnn_chinese_characters_rec
I replace conv2d with GhostModule in the cnn part,then train with my data, same epoch(100), the test accuracy is lower than the original conv2d(0.9824 vs 0.9879), Is this normal?
what's the version of your Pytorch? when I load the pretrained model,it will exits error:
_pickle.UnpicklingError: invalid load key, '
'.
I saw that there was detection results on the paper.
For the proper re-production of detection results, I'd like to refer your code... but seems not included in this repository.
Is there any other repository for the detection? or not available?
after train by myself,I convert to tflite。found the strideslice don‘t change the channel,then I found in the Ghostmodel channel_mult is always equal ratio-1(2-1=1),so filters-init_channels=0.the strideslice is useless
I have tried to implement Ghostnet myself on Tensorflow and I get about 3.7M parameters and about 138M MAC. Can you confirm that I should expect 5.2M parameters and 141M MAC?
Hello,
As per the paper, the validation accuracy on imagenet dataset of ghostnet is higher than mobilenet-v3 (75.7%). However, the actual experiment accuracy from this repo is 74% (lower than mobilenet-v3) .
The model ghostnet implemented at this repo is for width_ratio 1.0. Can I receive the pretrained ghostnet model with width ratio 1.3 (ghostnet 1.3x has 75.7% accuracy as per the paper)
To my understanding, suppose input feature map with shape (C, H, W),
for ordinary convolution:
output shape: (D, H, W), here suppose output D channels
while for ghost op, suppose ratio=2:
1. first, with ordinary convolution, input (C, H, W), output (D / 2, H, W),
2. second, still with ordinary convolution, input (D / 2, H, W), output (D / 2, H, W)
3. concatenate the above 2 output, then get final output (D, H, W)
here omit batch normalization, relu etc. for simplicity. The above three ops final reach almost the same effect with Densenet, though the motivation is different.
Please correct me if I have any misunderstanding.
具体的激活函数是作者设计,这个设计就很有讲究了,这些激活函数其实是类似于边缘检测算子或者高斯核,而不是非线性变换
how to train ghostnet in my dataset?
您好,我想問一下使用的預訓練的權重文件應該是yolov3還是Ghostnet的呢,期待您的回復!
When I test Ghostnet (drop all SE-modules) and mobilenetv1 on caffe and TensorRT, it shows that Ghostnet is 2 times slower than mobilenet. Is it because there are too many convs in ghostnet model?
Hi, very thanks for your working, @iamhankai
I'm interested in this GhostModule design, so I substitude the GhostModule in ghostnet for vanilla convolution in ResNet-50. With s=2, paper shows distinguished performance as 75.0% Top1-Acc and 2.2G FLOPs. But I trained this model only to gain a 73.7% Top1-Acc and 2.4G FLOPs. That makes me very upset. Could you give me relevant training setting file or remind me of some special training details? Thanks again!
What kind of ARM-based mobile phone you use testing the actual inference speed and the model runned on CPU or GPU?
Thank you for the open source code. Here I would like to ask what method is used to visualize the feature map in figure 1 of the paper. I look forward to your reply!
Thanks you guys' work a lot firstly.
I replaced the BasicBlock in ResNet18 with the GhostModule,but the inference processs cost more time after using it with GPU.It worked as the paper shows with CPU. Is this reasonable??
Above all, thanks for your great work! It really inspires me a lot! But now I have a question.
I replace all the Conv2d
operations in my network except the final ones, the model parameters really becomes much more less.
However, when testing, I found that the average forward time decreases a lot by the replacement (from 428FPS down to 354FPS).
So, is this a normal phenomenon? Or is this because of the concat
operation?
Hi! Thank you for your codes!
There are some differences in your code. In your paper, after AvgPooling, the features maps go through a conv1x1 and a fc layer to output the result, but in your pytorch version, the feature maps go through two fc layers, and in your tensorflow version, the feature maps seems to go through two conv1x1(fully convolution network), which one can produce the highest accuracy and reach the accuracy written in your paper?
Thank you!
Hi, very thanks for your working, @iamhankai
I'm interested in this GhostModule design, so I substitude the GhostModule in ghostnet for vanilla convolution in ResNet-50. With s=2, paper shows distinguished performance as 75.0% Top1-Acc and 2.2G FLOPs. But I trained this model only to gain a 73.7% Top1-Acc and 2.4G FLOPs. Could you give me relevant training setting file or remind me of some special training details? Thanks again!
您好,最近我读完这篇论文,我想请教几个问题1.程序中使用Ghost Bottleneck完成标准卷积和廉价变换。文中说Ghost module就可以完成(是在程序中一个Ghost Module第一卷积是标准卷积,第二卷积中去掉激活函数么)。2.程序中的恒等变换指的是满足条件的shortcut么。期待您的解惑,谢谢。
我已经下载了这个文档,但是不知道怎么用,还有就是那个pytorch版本为什么比这个tensorflow版本内容少那么多,刚入门不太懂,这个文档下载下来以后可以做一些迁移学习吗?刚入门的同学能用明白吗?
Hi,
It is said in your paper that the primary convolution in Ghost module can have customized kernel
size, which is a major difference from existing efficient convolution schemes. However, it seems that in this code all the kernel size of primary convolution in Ghost module are set to [1, 1], and the kernel set in _CONV_DEFS_0 are only used in blocks of stride=2. Is it set intentionally?
Hi,
According to the paper, you follow MobileNetV3 and replace bottleneck with G-bottleneck.
However, from the code, I think GhostNet is architecturally different from MobileNetV3.
For example, there is a layer in GhostNet with 48 #exp and 24 #out, which I couldn't find in MobileNetV3. Also, for the last few layers, MobileNetV3 has two 960 #exp and 160 #out layers but GhostNet has four of them. Moreover, in MobileNetV3 there are two 120 #exp and 40 #out layers while GhostNet only has one.
Can you explain why is this the case? How do you come up with this final architecture?
Have you tried directly replacing all the bottlenecks in MobileNetV3 to Ghost module without altering the base architecture?
Thanks,
Rudy
Hi, thanks for sharing such interesting work,
I find the proper inference information (e.g., FLOPs and Params) in the paper, and am wondering about the training cost instead, could you share the training cost comparison with other CNN architectures, like MobileNet-V3 structure you follow?
I read the paper Model Rubik’s Cube: Twisting Resolution, Depth and Width for TinyNets
I have interest to reproduce this on GhostNet-(X), could you please share us the details of r,d,c
setting compare to GhostNet-A?
@iamhankai 您好,我尝试了将ghostnet网络在place365数据集上进行微调,在迭代了100个epoch之后,Acc@1: 35.% ,Acc@5: 62.%。
部分超参数设置如下:
batch_size = 256;
loss: CrossEntropyLoss();
optimizer: SGD();
lr_init=0.1 & Sets the learning rate to the initial LR decayed by 10 every 30 epochs
先只对最后的classifier训练,后面又对整个网络进行了训练,得到的两者的结果都很相近。
请问您能给一些在place365数据集上训练时的建议和帮助吗?
非常感谢!
I find that in this repo, there is only a pretrained TF model with width ratio 1. Can more pretrained models with diverse width ratio(such as 0.75, 0.5, etc..) to be provided?
Thanks.
if use huawei disout,What is the effect?
flake8 testing of https://github.com/huawei-noah/ghostnet on Python 3.8.1
$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
./myconv2d.py:23:1: F822 undefined name 'DepthConv' in __all__
__all__ = ['DepthConv', 'GhostModule']
^
1 F822 undefined name 'DepthConv' in __all__
1
@iamhankai Hi,
Great work!
Why did you exclude EfficientNetB0 (0.390 BFlops - 76.3% Top1) from Accuracy-Latency chart?
Also what mini_batch_size
did you use for training GhostNet?
@iamhankai 您好,我尝试了将ghostnet网络在place365数据集上进行微调,在迭代了100个epoch之后,Acc@1: 35.% ,Acc@5: 62.%。
部分超参数设置如下:
batch_size = 256;
loss: CrossEntropyLoss();
optimizer: SGD();
lr_init=0.1 & Sets the learning rate to the initial LR decayed by 10 every 30 epochs
先只对最后的classifier训练,后面又对整个网络进行了训练,得到的两者的结果都很相近。
请问您能给一些在place365数据集上训练时的建议和帮助吗?
非常感谢!
Hi,
I am using Ghostnet backbone for training YoloV3 model in Tensorflow, but I am getting a bloated model. The checkpoint data size is approx. 68MB, but the checkpoint given here is of approx 20MB https://github.com/huawei-noah/ghostnet/blob/master/tensorflow/models/ghostnet_checkpoint.data-00000-of-00001
I am also training EfficientNet model with YoloV3 and that seems to be working fine, without any bloated size.
Could anyone or the author please confirm if this is the correct architecture or anything seems weird?
I have attached the Ghostnet architecture file out of the code.
Thanks.
ghostnet_model_arch.txt
论文的实验结果中,ghostnet在分类任务中用和mobilenetv3相当的FLOPs做到几乎同样的准确率,而在检测任务中用更加少的FLOPs就可以做到和mobilenetv3同样的准确率。请问这个现象怎么解释?
分类:
Model | FLOPs | Top-1 Acc (%) |
---|---|---|
MobileNetV3 Large 1.0× | 219 | 75.2 |
GhostNet 1.3× | 226 | 75.7 |
检测:
Backbone | Detection Framework | Backbone FLOPs | mAP |
---|---|---|---|
MobileNetV3 1.0× | Faster R-CNN | 219M | 26.9% |
GhostNet 1.1× | Faster R-CNN | 164M | 26.9% |
Hi,
Thanks for your explicit work.
May I ask how to set the arguments to realize different levels of computational complexity, like 0.5×, 1.0×, 1.3×?
I replaced the backbone network of Faster R-CNN with GhostNet and modified the structure of GhostNet, so I did not use the pre-training file you provided. This makes my model fail to converge. Can you share your experience in setting the hyperparameters? thank you
First of all, thanks for the great work.
This is related to #15 and #17
On section 4.2.2, this paper demostrates Ghostnet's briliant ability of computation cost reduce in object detection task. Unfortunely, there seems no related code in the repostory. It would be great if you can release it in the near future.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.