Very Deep Convolutional Networks for Large-Scale Image Recognition

Overview

pytorch-vgg

Some scripts to convert the VGG-16 and VGG-19 models [1] from Caffe to PyTorch.

The converted models can be used with the PyTorch model zoo and are available here:

VGG-16: https://web.eecs.umich.edu/~justincj/models/vgg16-00b39a1b.pth

VGG-19: https://web.eecs.umich.edu/~justincj/models/vgg19-d01eb7cb.pth

These models expect different preprocessing than the other models in the PyTorch model zoo. Images should be in BGR format in the range [0, 255], and the following BGR values should then be subtracted from each pixel: [103.939, 116.779, 123.68]

[1] Karen Simonyan and Andrew Zisserman, "Very Deep Convolutional Networks for Large-Scale Image Recognition", ICLR 2015

Comments
  • Fix caffemodel_to_t7.lua

    Fix caffemodel_to_t7.lua

    Thanks for providing these scripts! Just a couple small fixes: lua comments, and variable references. Had to clone the network outputs or the tests weren't passing.

    opened by rtqichen 1
  • 403 Forbidden for pretrained vgg19 on S3

    403 Forbidden for pretrained vgg19 on S3

    When trying to access the pre-trained vgg19 model:

    https://s3-us-west-2.amazonaws.com/jcjohns-models/vgg19-d01eb7cb.pth

    I am getting a 403 Forbidden error.

    I am running code that depends on it and I am pretty sure I could run the notebook a few days ago and since today am seeing the 403 errors.

    Is it possible there was a change int the S3 permission recently?

    opened by umarniz 0
  • libprotobuf ERROR google/protobuf/text_format.cc:288

    libprotobuf ERROR google/protobuf/text_format.cc:288

    when I run "th caffemodel_to_t7.lua" . I got the following error.

    [libprotobuf ERROR google/protobuf/text_format.cc:288] Error parsing text-format caffe.NetParameter: 42:14: Message type "caffe.PythonParameter" has no field named "param_str". Successfully loaded /home/xin/pytorch-vgg-master/snapshot_iter_2320.caffemodel warning: module 'train-data [type Data]' not found warning: module 'data_aug [type Python]' not found warning: module 'sub_mean [type Scale]' not found warning: module 'conv1_srelu1_1 [type Scale]' not found warning: module 'conv1_srelu1_3 [type Scale]' not found warning: module 'pool1_pool1_0_split [type Split]' not found warning: module 'res1_1_1_srelu_1 [type Scale]' not found warning: module 'res1_1_1_srelu_3 [type Scale]' not found warning: module 'res1_1_sum [type Eltwise]' not found warning: module 'res1_1_srelu_1 [type Scale]' not found warning: module 'res1_1_srelu_3 [type Scale]' not found warning: module 'res1_1_res1_1_srelu_3_0_split [type Split]' not found warning: module 'res1_2_1_srelu_1 [type Scale]' not found warning: module 'res1_2_1_srelu_3 [type Scale]' not found warning: module 'res1_2_sum [type Eltwise]' not found warning: module 'res1_2_srelu_1 [type Scale]' not found warning: module 'res1_2_srelu_3 [type Scale]' not found warning: module 'res1_2_res1_2_srelu_3_0_split [type Split]' not found warning: module 'res2_1_1_srelu_1 [type Scale]' not found warning: module 'res2_1_1_srelu_3 [type Scale]' not found warning: module 'res2_1_sum [type Eltwise]' not found warning: module 'res2_1_srelu_1 [type Scale]' not found warning: module 'res2_1_srelu_3 [type Scale]' not found warning: module 'res2_1_res2_1_srelu_3_0_split [type Split]' not found warning: module 'res2_2_1_srelu_1 [type Scale]' not found warning: module 'res2_2_1_srelu_3 [type Scale]' not found warning: module 'res2_2_sum [type Eltwise]' not found warning: module 'res2_2_srelu_1 [type Scale]' not found warning: module 'res2_2_srelu_3 [type Scale]' not found warning: module 'res2_2_res2_2_srelu_3_0_split [type Split]' not found warning: module 'res3_1_1_srelu_1 [type Scale]' not found warning: module 'res3_1_1_srelu_3 [type Scale]' not found warning: module 'res3_1_sum [type Eltwise]' not found warning: module 'res3_1_srelu_1 [type Scale]' not found warning: module 'res3_1_srelu_3 [type Scale]' not found warning: module 'res3_1_res3_1_srelu_3_0_split [type Split]' not found warning: module 'res3_2_1_srelu_1 [type Scale]' not found warning: module 'res3_2_1_srelu_3 [type Scale]' not found warning: module 'res3_2_sum [type Eltwise]' not found warning: module 'res3_2_srelu_1 [type Scale]' not found warning: module 'res3_2_srelu_3 [type Scale]' not found warning: module 'res3_2_res3_2_srelu_3_0_split [type Split]' not found warning: module 'res4_1_1_srelu_1 [type Scale]' not found warning: module 'res4_1_1_srelu_3 [type Scale]' not found warning: module 'res4_1_sum [type Eltwise]' not found warning: module 'res4_1_srelu_1 [type Scale]' not found warning: module 'res4_1_srelu_3 [type Scale]' not found warning: module 'res4_1_res4_1_srelu_3_0_split [type Split]' not found warning: module 'res4_2_1_srelu_1 [type Scale]' not found warning: module 'res4_2_1_srelu_3 [type Scale]' not found warning: module 'res4_2_sum [type Eltwise]' not found warning: module 'res4_2_srelu_1 [type Scale]' not found warning: module 'res4_2_srelu_3 [type Scale]' not found warning: module 'pool_avg_pool_avg_0_split [type Split]' not found warning: module 'cee_loss [type Python]' not found conv1: 64 3 7 7 res1_1_1: 64 64 3 3 res1_1_2: 64 64 3 3 res1_2_1: 64 64 3 3 res1_2_2: 64 64 3 3 res2_1_1: 128 64 3 3 res2_1_2: 128 128 3 3 res2_1_proj: 128 64 1 1 res2_2_1: 128 128 3 3 res2_2_2: 128 128 3 3 res3_1_1: 256 128 3 3 res3_1_2: 256 256 3 3 res3_1_proj: 256 128 1 1 res3_2_1: 256 256 3 3 res3_2_2: 256 256 3 3 res4_1_1: 512 256 3 3 res4_1_2: 512 512 3 3 res4_1_proj: 512 256 1 1 res4_2_1: 512 512 3 3 res4_2_2: 512 512 3 3 fc3: 1 1 512 3 fc3_t: 1 1 512 3 /home/xin/torch/install/bin/luajit: caffemodel_to_t7.lua:26: assertion failed! stack traceback: [C]: in function 'assert' caffemodel_to_t7.lua:26: in main chunk [C]: in function 'dofile' .../xin/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50

    opened by zhong-xin 0
  • AssertionError: y_diff = 0.000188 when converting vgg16 and vgg19 models

    AssertionError: y_diff = 0.000188 when converting vgg16 and vgg19 models

    th caffemodel_to_t7.lua -output_t7 VGG_ILSVRC_19_layers.t7 -input_caffemodel VGG_ILSVRC_19_layers.caffemodel -input_prototxt VGG_ILSVRC_19_layers_deploy.prototxt
    
    python t7_to_state_dict.py --input_t7 VGG_ILSVRC_19_layers.t7 --model_name vgg19
    python test_model.py --t7_file VGG_ILSVRC_19_layers.t7 --pth_file vgg19-bdbb0f7f.pth
    

    Upon running the test_model.py script, I get this error:

    Running test case 1 / 10
    Traceback (most recent call last):
      File "test_model.py", line 41, in <module>
        assert y_diff == 0, 'y_diff = %f' % y_diff
    AssertionError: y_diff = 0.000188
    

    For the vgg16 model:

    Running test case 1 / 10
    Traceback (most recent call last):
      File "test_model.py", line 41, in <module>
        assert y_diff == 0, 'y_diff = %f' % y_diff
    AssertionError: y_diff = 0.000198
    
    opened by ProGamerGov 0
  • model mismatch between *.t7 and *.pth after conversion

    model mismatch between *.t7 and *.pth after conversion

    I have converted caffemodel to torch .t7 file and pytorch .pth file, but something wrong when I use test_model.py to verify consistency between .t7 file and .pth file.

    Traceback (most recent call last):
      File "./test/test_model.py", line 41, in <module>
        assert y_diff == 0, 'y_diff = %f' % y_diff
    AssertionError: y_diff = 69.316125
    

    When I use vgg16 to classify an image by loading .t7 model and .pth model, I find the final results are not the same.

    How can I solve the problem to correctly convert .t7 model to .pth model ? Thanks.

    opened by xychen9459 0
  • KeyError: 'unexpected key

    KeyError: 'unexpected key "features.0.weight" in state_dict'

    Error trying to load vgg16-00b39a1b.pth

    weights = torch.load("./weights/vgg16-00b39a1b.pth")

    KeyError: 'unexpected key "features.0.weight" in state_dict'

    opened by mikejmills 4
Owner
Justin Johnson
Justin Johnson
Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! Very tiny! Stock Market Financial Technical Analysis Python library . Quant Trading automation or cryptocoin exchange

MyTT Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! to Stock Market Financial Technical Analysis Python

dev 34 Dec 27, 2022
PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place Recognition, CVPR 2018

PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place Recognition PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place

Mikaela Uy 294 Dec 12, 2022
This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of Coordinate Independent Convolutional Networks.

Orientation independent Möbius CNNs This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of

Maurice Weiler 59 Dec 9, 2022
A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019).

ClusterGCN ⠀⠀ A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019). A

Benedek Rozemberczki 697 Dec 27, 2022
Code for "FPS-Net: A convolutional fusion network for large-scale LiDAR point cloud segmentation".

FPS-Net Code for "FPS-Net: A convolutional fusion network for large-scale LiDAR point cloud segmentation", accepted by ISPRS journal of Photogrammetry

null 15 Nov 30, 2022
[ICLR 2021, Spotlight] Large Scale Image Completion via Co-Modulated Generative Adversarial Networks

Large Scale Image Completion via Co-Modulated Generative Adversarial Networks, ICLR 2021 (Spotlight) Demo | Paper [NEW!] Time to play with our interac

Shengyu Zhao 373 Jan 2, 2023
This implements one of result networks from Large-scale evolution of image classifiers

Exotic structured image classifier This implements one of result networks from Large-scale evolution of image classifiers by Esteban Real, et. al. Req

null 54 Nov 25, 2022
PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

Yulun Zhang 1.2k Dec 26, 2022
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 14 Oct 14, 2022
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Isen (Songyao Jiang) 128 Dec 8, 2022
Pytorch implementation for "Large-Scale Long-Tailed Recognition in an Open World" (CVPR 2019 ORAL)

Large-Scale Long-Tailed Recognition in an Open World [Project] [Paper] [Blog] Overview Open Long-Tailed Recognition (OLTR) is the author's re-implemen

Zhongqi Miao 761 Dec 26, 2022
A large-scale face dataset for face parsing, recognition, generation and editing.

CelebAMask-HQ [Paper] [Demo] CelebAMask-HQ is a large-scale face image dataset that has 30,000 high-resolution face images selected from the CelebA da

switchnorm 1.7k Dec 26, 2022
A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks

SVHNClassifier-PyTorch A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks If

Potter Hsu 182 Jan 3, 2023
SLIDE : In Defense of Smart Algorithms over Hardware Acceleration for Large-Scale Deep Learning Systems

The SLIDE package contains the source code for reproducing the main experiments in this paper. Dataset The Datasets can be downloaded in Amazon-

Intel Labs 72 Dec 16, 2022
DeepLM: Large-scale Nonlinear Least Squares on Deep Learning Frameworks using Stochastic Domain Decomposition (CVPR 2021)

DeepLM DeepLM: Large-scale Nonlinear Least Squares on Deep Learning Frameworks using Stochastic Domain Decomposition (CVPR 2021) Run Please install th

Jingwei Huang 130 Dec 2, 2022
Colossal-AI: A Unified Deep Learning System for Large-Scale Parallel Training

ColossalAI An integrated large-scale model training system with efficient parallelization techniques Installation PyPI pip install colossalai Install

HPC-AI Tech 7.1k Jan 3, 2023
Official implementation of "Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets" (CVPR2021)

Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets This is the official implementation of "Towards Good Pract

Sanja Fidler's Lab 52 Nov 22, 2022
Revisiting Oxford and Paris: Large-Scale Image Retrieval Benchmarking

Revisiting Oxford and Paris: Large-Scale Image Retrieval Benchmarking We revisit and address issues with Oxford 5k and Paris 6k image retrieval benchm

Filip Radenovic 188 Dec 17, 2022
This project is a loose implementation of paper "Algorithmic Financial Trading with Deep Convolutional Neural Networks: Time Series to Image Conversion Approach"

Stock Market Buy/Sell/Hold prediction Using convolutional Neural Network This repo is an attempt to implement the research paper titled "Algorithmic F

Asutosh Nayak 136 Dec 28, 2022