BardOfCodes / pytorch_deeplab_large_fov

Pytorch implementation of Deeplab Large-FOV
29 stars 7 forks source link

Checkpoint for DeepLab V1 model #1

Open j-min opened 6 years ago

j-min commented 6 years ago

Hi! Thank you for sharing your code.

I try to build caffe with original deeplab to convert vgg16_20M.caffemodel and deploy21.prototxt to pytorch checkpoint.. but building old caffe gives me too many bugs.

Could you please share the pytorch checkpoint file you used? Huge thanks in advance :)

yuantailing commented 6 years ago

Assuming your OS is Ubuntu 16.04, you have downloaded matio-1.5.12.7z, and your home is /root.

Build caffe:

RUN apt-get update && \
    apt-get install -y opencl-headers build-essential protobuf-compiler \
        libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev \
        libopencv-core-dev  libopencv-highgui-dev libsnappy-dev \
        libatlas-base-dev cmake libstdc++6-4.8-dbg libgoogle-glog0v5 libgoogle-glog-dev \
        libgflags-dev liblmdb-dev git python-pip gfortran libopencv-dev && \
    apt-get clean

RUN git clone --recursive https://github.com/martinkersner/train-DeepLab.git ~/train-DeepLab

RUN pip install ipython~=5.0 numpy==1.14.* && \
    pip install -r ~/train-DeepLab/code/python/requirements.txt && \
    rm -r ~/.cache/pip

COPY matio-1.5.12.7z /root/

RUN apt-get update && \
    apt-get install -y p7zip-full bc && \
    cd ~/ && \
    7z x matio-1.5.12.7z && \
    cd matio-1.5.12 && \
    chmod +x configure && \
    ./configure && \
    make -j8 && \
    make install && \
    ldconfig

COPY common.cuh /root/train-DeepLab/code/include/caffe/common.cuh

RUN cd ~/train-DeepLab/code && \
    cp Makefile.config.example Makefile.config && \
    sed -i '/^PYTHON_INCLUDE/a    /usr/local/lib/python2.7/dist-packages/numpy/core/include/ \\' Makefile.config && \
    sed -i 's/\.\/src \.\/include/\.\/src \.\/include \/usr\/include\/hdf5\/serial/g' Makefile && \
    sed -i 's/lmdb boost_system hdf5_hl hdf5 m/lmdb boost_system hdf5_serial_hl hdf5_serial m/g' Makefile && \
    ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.10.1.0 /usr/lib/x86_64-linux-gnu/libhdf5.so && \
    ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.10.0.2 /usr/lib/x86_64-linux-gnu/libhdf5_hl.so && \
    make -j8

RUN cd ~/train-DeepLab/code && \
    make -j8 py && \
    echo "export PYTHONPATH=~/train-DeepLab/code/python:$PYTHONPATH" >> ~/.bashrc

common.cuh:

#ifndef CAFFE_COMMON_CUH_
#define CAFFE_COMMON_CUH_

#include <cuda.h>

  #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600

  #else
  static __inline__ __device__ double atomicAdd(double *address, double val) {
    unsigned long long int* address_as_ull = (unsigned long long int*)address;
    unsigned long long int old = *address_as_ull, assumed;
    if (val==0.0)
      return __longlong_as_double(old);
    do {
      assumed = old;
      old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed)));
    } while (assumed != old);
    return __longlong_as_double(old);
  }

  #endif
#endif
zbf1991 commented 5 years ago

@j-min I have the same bugs with you, have you solved?

llyfzu commented 5 years ago

@j-min I have downloaded vgg16_20M.caffemodel, but where should I download deploy21.prototxt? Can you tell me?Thanks

qi0416 commented 1 year ago

我已经下载了vgg16_20M.caffemodel,但是我应该在哪里下载deploy21.prototxt?你能告诉我吗?谢谢

I need vgg16_20M.caffemodel, can you give me?