Skip to content
项目

wielandbrendel/bag-of-local-features-models

在 GitHub 查看

关于

Pretrained bag-of-local-features neural networks

系统与基础设施

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

BagNets

In this repository you find the model specification and pretrained weights for the bag-of-local-feature models published in

Installation

pip install git+https://github.com/wielandbrendel/bag-of-local-features-models.git

Usage

The code provides simple means to initialize the models in either Pytorch or Keras. After installation please use the following code snippets to load the models:

import bagnets.pytorchnet
pytorch_model = bagnets.pytorchnet.bagnet17(pretrained=True)
import bagnets.kerasnet
keras_model = bagnets.kerasnet.bagnet17()

and replace bagnet17 with whatever size you want (available are bagnet9, bagnet17 and bagnet33). The last number refers to the maximum local patch size that the network can integrate over.

FAQ

  • Do I need to manually split the image into patches?

    No. You use BagNets just like any other DNN and apply it to the whole image. The BagNets are really similar to ResNets. In a nutshell we simply replaced most 3x3 convolutions by 1x1 convolutions. This effectively means that the largest receptive fields in the BagNets are of size qxq (where q is smaller than the image size), which is equivalent to splitting the image into individual patches.

Image Preprocessing

The models expect inputs with the standard torchvision preprocessing, i.e.

  • with RGB channels
  • in the format [channel, x, y]
  • loaded with pixel values between 0 and 1 which are then...
  • ...normalized by mean and standard deviation, i.e. for given mean: (M1,...,Mn) and std: (S1,..,Sn) for n channels, the normalization should transform each channel of the input as input[channel] = (input[channel] - mean[channel]) / std[channel]

The mean and standard deviation are:

  • mean = [0.485, 0.456, 0.406]
  • std = [0.229, 0.224, 0.225]

Citation

If you find BagNets useful for your scientific work, please consider citing it in resulting publications:

@article{brendel2018bagnets,
  title={Approximating CNNs with Bag-of-local-Features models works surprisingly well on ImageNet},
  author={Brendel, Wieland and Bethge, Matthias},
  journal={International Conference on Learning Representations},
  year={2019},
  url={https://openreview.net/pdf?id=SkfMWhAqYQ},
}

You can find the paper on OpenReview: https://openreview.net/pdf?id=SkfMWhAqYQ

Authors

探索相关项目

加载中…