{"id":7552013,"url":"https://github.com/XuChunqiao/Tensorflow-Fast-MPNCOV","last_synced_at":"2025-05-14T05:33:57.945Z","repository":{"id":232107414,"uuid":"199121415","full_name":"XuChunqiao/Tensorflow-Fast-MPNCOV","owner":"XuChunqiao","description":"Fast_MPNCOV implemented by TensorFlow2.0 for training from scratch \u0026 finetuning； BCNN  implemented by Tensorflow2.0 for finetuning；Compact BCNN implemented by Tensorflow2.0 for finetuning","archived":false,"fork":false,"pushed_at":"2019-11-22T07:55:05.000Z","size":194,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-19T01:43:32.048Z","etag":null,"topics":["bcnn","compact-bcnn","fast-mpncov","python","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XuChunqiao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-27T05:39:21.000Z","updated_at":"2022-04-25T01:58:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f7f996b-f07a-42e2-a8aa-58e7f3a265f8","html_url":"https://github.com/XuChunqiao/Tensorflow-Fast-MPNCOV","commit_stats":null,"previous_names":["xuchunqiao/tensorflow-fast-mpncov"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuChunqiao%2FTensorflow-Fast-MPNCOV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuChunqiao%2FTensorflow-Fast-MPNCOV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuChunqiao%2FTensorflow-Fast-MPNCOV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XuChunqiao%2FTensorflow-Fast-MPNCOV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XuChunqiao","download_url":"https://codeload.github.com/XuChunqiao/Tensorflow-Fast-MPNCOV/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254077040,"owners_count":22010646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bcnn","compact-bcnn","fast-mpncov","python","tensorflow"],"created_at":"2024-04-08T01:12:42.732Z","updated_at":"2025-05-14T05:33:57.530Z","avatar_url":"https://github.com/XuChunqiao.png","language":"Python","funding_links":[],"categories":["Other 💛💛💛💛💛\u003ca name=\"Other\" /\u003e"],"sub_categories":["迭代矩阵平方根归一化网络（称为快速MPN-COV），该网络非常有效，适合大规模数据集"],"readme":"# Tensorflow Fast-MPNCOV\n![](https://camo.githubusercontent.com/f2cdc5f25d743e922fd2c23e8a2a42e1f25c1e36/687474703a2f2f7065696875616c692e6f72672f70696374757265732f666173745f4d504e2d434f562e4a5047)\n## Introduction\nThis repository contains the source code under ***TensorFlow2.0 framework*** and models trained on ImageNet 2012 dataset for the following paper:\u003cbr\u003e\n```\n@InProceedings{Li_2018_CVPR,\n           author = {Li, Peihua and Xie, Jiangtao and Wang, Qilong and Gao, Zilin},\n           title = {Towards Faster Training of Global Covariance Pooling Networks by Iterative Matrix Square Root Normalization},\n           booktitle = { IEEE Int. Conf. on Computer Vision and Pattern Recognition (CVPR)},\n           month = {June},\n           year = {2018}\n     }\n```\nThis paper concerns an iterative matrix square root normalization network (called fast MPN-COV), which is very efficient, fit for large-scale datasets, as opposed to its predecessor (i.e., [MPN-COV](https://github.com/jiangtaoxie/MPN-COV)) published in ICCV17) that performs matrix power normalization by Eigen-decompositon. If you use the code, please cite this [fast MPN-COV](http://peihuali.org/iSQRT-COV/iSQRT-COV_bib.htm) work and its predecessor (i.e., [MPN-COV](http://peihuali.org/iSQRT-COV/iSQRT-COV_bib.htm)).           \n## Classification results\n#### Classification results (single crop 224x224, %) on ImageNet 2012 validation set\n\u003ctable\u003e\n\u003ctr\u003e                                      \n    \u003ctd rowspan=\"3\" align='center'\u003eNetwork\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd rowspan=\"3\" align='center'\u003eDim\u003c/td\u003e\n    \u003ctd colspan=\"3\" align='center'\u003eTop1_err/Top5_err\u003c/td\u003e\n    \u003ctd colspan=\"2\" rowspan=\"2\" align='center'\u003ePre-trained models\u003cbr\u003e(tensorflow)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd rowspan=\"2\" align='center'\u003epaper\u003c/td\u003e\n    \u003ctd colspan=\"2\" align='center'\u003ereproduce\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003etensorflow\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://github.com/jiangtaoxie/fast-MPN-COV\" title=\"标题\"\u003epytorch\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003eGoogleDrive\u003c/td\u003e\n    \u003ctd align='center'\u003eBaiduDrive\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPN-COV-VGG-D\u003c/td\u003e\n    \u003ctd rowspan=\"3\" align='center'\u003e 32K\u003c/td\u003e\n    \u003ctd align='center'\u003e26.55/8.94\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e23.98/7.12\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e23.98/7.12\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://drive.google.com/open?id=19c8ei0FdeRMfeITBApvrjsV49lp1-2ss\" title=\"标题\"\u003e650.4M\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://pan.baidu.com/s/13u1nih7bC1b4Mgn9APYxBA\" title=\"标题\"\u003e650.4M\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPN-COV-ResNet50\u003c/td\u003e\n    \u003ctd align='center'\u003e22.14/6.22\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e21.57/6.14\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e21.71/6.13\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://drive.google.com/file/d/1kXi3PGixfn7QZaxtLK2DkiZ6h-zoGpfq/view?usp=sharing\" title=\"标题\"\u003e217.3M\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://pan.baidu.com/s/109VXo2XYyI2gvcHL9Xlv9g\" title=\"标题\"\u003e217.3M\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPN-COV-ResNet101\u003c/td\u003e\n    \u003ctd align='center'\u003e21.21/5.68\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e20.50/5.45\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e20.99/5.56\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://drive.google.com/file/d/1RFdw2oEZLe03SCDFanwQKHUY13OeEzp0/view\" title=\"标题\"\u003e289.9M\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003ca href=\"https://pan.baidu.com/s/1fj0-vukSbRz1ihTDtAbUdA\" title=\"标题\"\u003e289.9M\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003c/table\u003e\n\n* We convert the trained fast-MPNCOV-VGG-D model from the PyTorch framework to TensorFlow framework.\n\n#### Fine-grained classification results (top-1 accuracy rates, %)\n\u003ctable\u003e\n\u003ctr\u003e                                      \n    \u003ctd rowspan=\"2\" align='center'\u003eNetwork\u003c/td\u003e\n    \u003ctd rowspan=\"2\" align='center'\u003eDim\u003c/td\u003e\n    \u003ctd colspan=\"2\" align='center'\u003e\u003ca href=\"http://www.vision.caltech.edu/visipedia/CUB-200-2011.html\" title=\"标题\"\u003eCUB\u003c/a\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\" align='center'\u003e\u003ca href=\"http://ai.stanford.edu/~jkrause/cars/car_dataset.html\" title=\"标题\"\u003eAircraft\u003c/a\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\" align='center'\u003e\u003ca href=\"http://www.robots.ox.ac.uk/~vgg/data/oid/\" title=\"标题\"\u003eCars\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd align='center'\u003epaper\u003c/td\u003e\n    \u003ctd align='center'\u003ereproduce\u003cbr\u003e(tensorflow)\u003c/td\u003e\n    \u003ctd align='center'\u003epaper\u003c/td\u003e\n    \u003ctd align='center'\u003ereproduce\u003cbr\u003e(tensorflow)\u003c/td\u003e\n    \u003ctd align='center'\u003epaper\u003c/td\u003e\n    \u003ctd align='center'\u003ereproduce\u003cbr\u003e(tensorflow)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPNCOV-COV-VGG-D\u003c/td\u003e\n    \u003ctd rowspan=\"3\"\u003e 32K\u003c/td\u003e\n    \u003ctd align='center'\u003e87.2\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e86.95\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e90.0\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e91.74\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e92.5\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e92.95\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPNCOV-COV-ResNet50\u003c/td\u003e\n    \u003ctd align='center'\u003e88.1\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e87.6\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e90.0\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e90.5\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e92.8\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e93.2\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003efast-MPNCOV-COV-ResNet101\u003c/td\u003e\n    \u003ctd align='center'\u003e88.7\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e88.1\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e91.4\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e91.8\u003c/strong\u003e\u003c/td\u003e\n    \u003ctd align='center'\u003e93.3\u003c/td\u003e\n    \u003ctd align='center'\u003e\u003cstrong\u003e93.9\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n* Our method uses neither bounding boxes nor part annotations\u003cbr\u003e\n* The reproduced results are obtained by simply finetuning our pre-trained fast MPN-COV-ResNet model with a small learning rate, which do not perform SVM as our paper described.\u003cbr\u003e\n```\nparameter setting\nfast-MPNCOV-VGG-D: weightdecay=1e-4, batchsize=10, learningrate=3e-3 for all layers except the FC layer(which is 5×learningrate, and the learning rate is reduced to 3e-4 at epoch 20(FC: 5×3e-4)\n```\n## Implementation details\nWe implement our Fast MPN-COV (i.e., iSQRT-COV) [meta-layer](https://github.com/XuChunqiao/Tensorflow-Fast-MPNCOV/blob/master/src/representation/MPNCOV.py) under ***Tensorflow2.0*** package. We release two versions of code:\u003cbr\u003e \n\n* The backpropagation of our meta-layer without using autograd package;\u003cbr\u003e\n* The backpropagation of our meta-layer with using autograd package(**TODO**).\u003cbr\u003e\n\nFor making our Fast MPN-COV meta layer can be added in a network conveniently, we divide any network for three parts: \u003cbr\u003e\n* features extractor;\u003cbr\u003e\n* global image representation;\u003cbr\u003e\n* classifier. \u003cbr\u003e\n\nAs such, we can arbitrarily combine a network with our Fast MPN-COV or some other global image representation methods (e.g.,Global average pooling, Bilinear pooling, Compact bilinear pooling, etc.) \n## Installation and Usage\n1. Install [Tensorflow (2.0.0b0)](https://tensorflow.google.cn/install)\n2. type ```git clone https://github.com/XuChunqiao/Tensorflow-Fast-MPNCOV ```\n3. prepare the dataset as follows\n```\n.\n├── train\n│   ├── class1\n│   │   ├── class1_001.jpg\n│   │   ├── class1_002.jpg\n|   |   └── ...\n│   ├── class2\n│   ├── class3\n│   ├── ...\n│   ├── ...\n│   └── classN\n└── val\n    ├── class1\n    │   ├── class1_001.jpg\n    │   ├── class1_002.jpg\n    |   └── ...\n    ├── class2\n    ├── class3\n    ├── ...\n    ├── ...\n    └── classN\n```\n### train from scratch\n1. ``` cp ./trainingFromScratch/imagenet/imagenet_tfrecords.py ./ ```\n2. modify the dataset path and run ``` python imagenet_tfrecords.py ``` to create tfrecord files\n3. modify the parameters in train.sh ```sh train.sh```\n### finetune fast-MPNCOV models\n1. modify the parameters in finetune.sh\n2. ```sh finetune.sh```\n## Other Implementations\n* [MatConvNet Implementation](https://github.com/jiangtaoxie/matconvnet.fast-mpn-cov)\n* [PyTorch Implementation](https://github.com/jiangtaoxie/fast-MPN-COV)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXuChunqiao%2FTensorflow-Fast-MPNCOV","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FXuChunqiao%2FTensorflow-Fast-MPNCOV","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXuChunqiao%2FTensorflow-Fast-MPNCOV/lists"}