Giter Club home page Giter Club logo

gabor_cnn_pytorch's People

Contributors

jxgu1016 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gabor_cnn_pytorch's Issues

error fatal: cuda_runtime.h

Hi there, I try to run the command:
sh install.sh
But there is a problem and show this message:

In file included from <línea-de-orden>:0:0:
/usr/include/stdc-predef.h:40:1: error fatal: cuda_runtime.h: No existe el fichero o el directorio
#endif
^
compilación terminada.
error: command '/usr/bin/nvcc' failed with exit status
1

My version of gcc is 4.8, python 3.7 and torch 1.2

Do you know what is the problem?
Thanks

Change data generator to mnist-rot

Hi,

I using data generator as ORN as following in main.py.

#train_dataset = datasets.MNIST(root=args.dataset_dir, train=True, 
#    				download=True, transform=train_transform)
#test_dataset = datasets.MNIST(root=args.dataset_dir, train=False, 
#                    download=True,transform=test_transform)
#
#train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=args.batch_size,
#                                num_workers=args.workers, pin_memory=True, shuffle=True)
#test_loader = torch.utils.data.DataLoader(test_dataset, batch_size=args.batch_size,
#                                num_workers=args.workers, pin_memory=True, shuffle=True)


import math
import numbers
import random
from PIL import Image, ImageOps
# custom transform
class RandomRotate(object):
    """Rotate the given PIL.Image counter clockwise around its centre by a random degree
    (drawn uniformly) within angle_range. angle_range is a tuple (angle_min, angle_max).
    Empty region will be padded with color specified in fill."""
    def __init__(self, angle_range=(-180,180), fill='black'):
        assert isinstance(angle_range, tuple) and len(angle_range) == 2 and angle_range[0] <= angle_range[1]
        assert isinstance(fill, numbers.Number) or isinstance(fill, str) or isinstance(fill, tuple)
        self.angle_range = angle_range
        self.fill = fill

    def __call__(self, img):
        angle_min, angle_max = self.angle_range
        angle = angle_min + random.random() * (angle_max - angle_min)
        theta = math.radians(angle)
        w, h = img.size
        diameter = math.sqrt(w * w + h * h)
        theta_0 = math.atan(float(h) / w)
        w_new = diameter * max(abs(math.cos(theta-theta_0)), abs(math.cos(theta+theta_0)))
        h_new = diameter * max(abs(math.sin(theta-theta_0)), abs(math.sin(theta+theta_0)))
        pad = math.ceil(max(w_new - w, h_new - h) / 2)
        img = ImageOps.expand(img, border=int(pad), fill=self.fill)
        img = img.rotate(angle, resample=Image.BICUBIC)
        return img.crop((pad, pad, w + pad, h + pad))


train_loader = torch.utils.data.DataLoader(
    datasets.MNIST(root=args.dataset_dir, train=True, download=True,
                   transform=transforms.Compose([
                       transforms.Scale(32),
                       RandomRotate((-180, 180)),
                       transforms.ToTensor(),
                       transforms.Normalize((0.1307,), (0.3081,))
                   ])), batch_size=args.batch_size,
                                num_workers=args.workers, pin_memory=True, shuffle=True)
test_loader = torch.utils.data.DataLoader(
    datasets.MNIST(root=args.dataset_dir, train=False, transform=transforms.Compose([
                       transforms.Scale(32),
                       RandomRotate((-180, 180)),
                       transforms.ToTensor(),
                       transforms.Normalize((0.1307,), (0.3081,))
                   ])), batch_size=args.batch_size,
                                num_workers=args.workers, pin_memory=True, shuffle=True)

The original data size is 28x28.
The original size after x = self.model(x) is 128x320x1x1.
After x = x.view(-1, 80*2, self.channel) is 128x80x4

The mnist-rot data is padding to 32x32.
The size after x = self.model(x) is 128x320x2x2.
After x = x.view(-1, 80*2, self.channel) is 512x80x4 which change the batch size!!

Can you tell me how to fix it or just simply change the padding number in net_factory?
Thank you!

error running demo

Met an error when i run the demo with cpu "python main.py --model gcn" :

Traceback (most recent call last):
File "main.py", line 144, in
train(epoch+1)
File "main.py", line 107, in train
for batch_idx, (data, target) in enumerate(train_loader):
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.p
y", line 804, in next
idx, data = self._get_data()
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.p
y", line 771, in _get_data
success, data = self._try_get_data()
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.p
y", line 737, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.forma
t(pids_str))
RuntimeError: DataLoader worker (pid(s) 7024, 4932, 1492, 3276) exited unexpecte
dly

How to see the model

Hi,

How can I see the model after using "visualize_graph(model, writer, input_size=(1, 1, 28, 28))"
There are many log in demo/runs/May23xxxx
Thanks for your help!!

error running main.py

I was running your github code for the demo: main.py. But I'm getting the following error:

python main.py --model gcn Traceback (most recent call last):
File "main.py", line 75, in
model = get_network_fn(args.model)
File "/home/nazmul/NAZMUL/Research/Model Inversion Attack/Gabor Filter/GCN/Gabor_CNN_PyTorch/demo/net_factory.py", line 51, in get_network_fn
'gcn': GCN(channel=4),
File "/home/nazmul/NAZMUL/Research/Model Inversion Attack/Gabor Filter/GCN/Gabor_CNN_PyTorch/demo/net_factory.py", line 12, in init
GConv(1, 10, 5, padding=2, stride=1, M=channel, nScale=1, bias=False, expand=True),
File "/home/nazmul/NAZMUL/Research/Model Inversion Attack/Gabor Filter/GCN/Gabor_CNN_PyTorch/gcn/layers/GConv.py", line 83, in init
padding, dilation, groups, bias, expand)
File "/home/nazmul/NAZMUL/Research/Model Inversion Attack/Gabor Filter/GCN/Gabor_CNN_PyTorch/gcn/layers/GConv.py", line 41, in init
False, _pair(0), groups, bias)
TypeError: init() takes exactly 12 arguments (11 given)

Can you please suggest me any solution? Thank you.

run on gup

Can it run on gup? My display cannot be compiled on gpu thanks

Here are some suggestions for running on Windows

  1. The dependency package version is important and this is the environment on my computer (python 3.6.8 )

      - torch==1.1.0
    
       - torchvision==0.2.2.post3 
        (I test torchvison==0.3.0 on windows,But the terminal tells me "Torchvision import _C ImportError: DLL Load failed" )
    
     - tensorboard==2.8.0
    
     - future==0.18.2
    
  2. Here are some of the problems you may encounter and how to solve them

Segmentation fault

Hi there:
I also tried install from another computer and I managed to install the gcn. With python 3.6, but at the moment when I want to run demo :

python main.py --model gcn --gpu 0

My terminal shows this problem:

# python main.py --model gcn --gpu 0
GCN(
(model): Sequential(
(0): GConv(1, 10, kernel_size=(4, 5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(1): BatchNorm2d(40, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace)
(3): GConv(10, 20, kernel_size=(4, 5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(4): BatchNorm2d(80, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): GConv(20, 40, kernel_size=(4, 5, 5), stride=(1, 1), bias=False)
(8): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace)
(10): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(11): GConv(40, 80, kernel_size=(4, 5, 5), stride=(1, 1), bias=False)
(12): BatchNorm2d(320, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(13): ReLU(inplace)
)
(fc1): Linear(in_features=80, out_features=1024, bias=True)
(relu): ReLU(inplace)
(dropout): Dropout(p=0.5)
(fc2): Linear(in_features=1024, out_features=10, bias=True)
)
/home/deeplearninglapi/Gabor_CNN_PyTorch/gcn/layers/GConv.py:67: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
for i in range(x.size(1)):
Segmentation fault (core dumped)

I searched out what is the meaning of "Segmentation fault" but I didn't find the real problem. Do you know what the problem is about?

Thanks a lot

The python version should be 3.x ?

Hi, due to that the division operation is different between python 2.x and python 3.x, there is some
incorrectly code of division operation if python 2.x is used. For example, line 107 of GConv.py, the
theta would be 0 for all filter. Hope you could mention the python version in README.

error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’

When I followed the instruction of ReadMe, something occurred in the ¨sh install.sh¨ command.Here is the information:
Compiling cuda kernels... rm: 无法删除'libgcn_kernel.cu.o': 没有那个文件或目录 Installing extension... Including CUDA code. running clean removing 'build/temp.linux-x86_64-3.5' (and everything under it) Including CUDA code. running install Checking .pth file support in /usr/local/lib/python3.5/dist-packages/ /usr/bin/python -E -c pass TEST PASSED: /usr/local/lib/python3.5/dist-packages/ appears to support .pth files running bdist_egg running egg_info writing dependency_links to gcn.egg-info/dependency_links.txt writing top-level names to gcn.egg-info/top_level.txt writing requirements to gcn.egg-info/requires.txt writing gcn.egg-info/PKG-INFO reading manifest file 'gcn.egg-info/SOURCES.txt' writing manifest file 'gcn.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying gcn/_ext/libgcn/__init__.py -> build/lib.linux-x86_64-3.5/gcn/_ext/libgcn running build_ext generating cffi module 'build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.c' creating build/temp.linux-x86_64-3.5 building 'gcn._ext.libgcn._libgcn' extension creating build/temp.linux-x86_64-3.5/build creating build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/home creating build/temp.linux-x86_64-3.5/home/Gabor_CNN_PyTorch creating build/temp.linux-x86_64-3.5/home/Gabor_CNN_PyTorch/gcn creating build/temp.linux-x86_64-3.5/home/Gabor_CNN_PyTorch/gcn/src x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Igcn/src -I/usr/include/python3.5m -c build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.o -std=c99 -fopenmp x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH -I/usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Igcn/src -I/usr/include/python3.5m -c /home/Gabor_CNN_PyTorch/gcn/src/libgcn.c -o build/temp.linux-x86_64-3.5/home/Gabor_CNN_PyTorch/gcn/src/libgcn.o -std=c99 -fopenmp In file included from /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/TH.h:4:0, from /home/Gabor_CNN_PyTorch/gcn/src/libgcn.c:1: gcn/src/generic/GaborOrientationFilter.c: In function ‘gcn_Float_GOF_Producing’: gcn/src/generic/GaborOrientationFilter.c:10:22: error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’ THArgCheck(weight->nDimension == 5, 1, "only supports a batch of GOFs."); ^ /usr/local/lib/python3.5/dist-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:111:35: note: in definition of macro ‘THArgCheck’ _THArgCheck(__FILE__, __LINE__, __VA_ARGS__); \ ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Do you know why this happens?Thank you!

Error occur whern type "sh install.sh"

Dear jxgu1016,

Sorry for bothering.
Here is my system :
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
Pytorch installed from (source or binary): conda install pytorch torchvision cuda90 -c pytorch
GCC/Compiler version (if compiling from source): gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
CUDA/cuDNN version: cuda9.0 / cuDNN7.0.5
GPU model and memory: Nvidia 1070

When I type "sh install.sh"
The message show :

Compiling cuda kernels...
rm: 無法移除 'libgcn_kernel.cu.o': 沒有此一檔案或目錄
In file included from /usr/local/cuda-9.0/bin/../targets/x86_64-linux/include/host_config.h:50:0,
from /usr/local/cuda-9.0/bin/../targets/x86_64-linux/include/cuda_runtime.h:78,
from :0:
/usr/local/cuda-9.0/bin/../targets/x86_64-linux/include/crt/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 6 are not supported!
#error -- unsupported GNU version! gcc versions later than 6 are not supported!
^~~~~
Installing extension...
Including CUDA code.
running clean
removing 'build/temp.linux-x86_64-3.5' (and everything under it)
Exception ignored in: <function WeakValueDictionary.init..remove at 0x7fee058d3ae8>
Traceback (most recent call last):
File "/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
Including CUDA code.
running install
running bdist_egg
running egg_info
writing requirements to gcn.egg-info/requires.txt
writing top-level names to gcn.egg-info/top_level.txt
writing gcn.egg-info/PKG-INFO
writing dependency_links to gcn.egg-info/dependency_links.txt
reading manifest file 'gcn.egg-info/SOURCES.txt'
writing manifest file 'gcn.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying gcn/_ext/libgcn/init.py -> build/lib.linux-x86_64-3.5/gcn/_ext/libgcn
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.c'
creating build/temp.linux-x86_64-3.5
building 'gcn._ext.libgcn._libgcn' extension
creating build/temp.linux-x86_64-3.5/build
creating build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/media
creating build/temp.linux-x86_64-3.5/media/luojiewei
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn
creating build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -fpic -fPIC -fPIC -DWITH_CUDA -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Igcn/src -I/home/luojiewei/anaconda3/envs/tf35/include/python3.5m -c build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.o -fopenmp
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -fpic -fPIC -fPIC -DWITH_CUDA -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Igcn/src -I/home/luojiewei/anaconda3/envs/tf35/include/python3.5m -c /media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn.c -o build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn.o -fopenmp
In file included from generic/GaborOrientationFilter.c:1:0,
from /home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:10,
from /media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn.c:12:
gcn/src/generic/GaborOrientationFilter.c: In function ‘gcn_Float_GOF_Producing’:
gcn/src/generic/GaborOrientationFilter.c:29:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (l = 0; l < nChannel * kH * kW; l++) {
^
In file included from generic/GaborOrientationFilter.c:1:0,
from /home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH/THGenerateFloatTypes.h:11,
from /media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn.c:12:
gcn/src/generic/GaborOrientationFilter.c: In function ‘gcn_Double_GOF_Producing’:
gcn/src/generic/GaborOrientationFilter.c:29:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (l = 0; l < nChannel * kH * kW; l++) {
^
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -fpic -fPIC -fPIC -DWITH_CUDA -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/luojiewei/anaconda3/envs/tf35/lib/python3.5/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -Igcn/src -I/home/luojiewei/anaconda3/envs/tf35/include/python3.5m -c /media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn_cuda.c -o build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn_cuda.o -fopenmp
gcc -pthread -shared -L/home/luojiewei/anaconda3/envs/tf35/lib -Wl,-rpath=/home/luojiewei/anaconda3/envs/tf35/lib,--no-as-needed build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/gcn._ext.libgcn._libgcn.o build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn.o build/temp.linux-x86_64-3.5/media/luojiewei/70303F89D6F80E5A/code/DL/RotateInv/Gabor_CNN_PyTorch-master/gcn/src/libgcn_cuda.o gcn/src/libgcn_kernel.cu.o -L/home/luojiewei/anaconda3/envs/tf35/lib -lpython3.5m -o build/lib.linux-x86_64-3.5/gcn/_ext/libgcn/_libgcn.abi3.so
gcc: error: gcn/src/libgcn_kernel.cu.o: 沒有此一檔案或目錄
error: command 'gcc' failed with exit status 1

Can you tell me how to fix it?
Many thanks!!

run on gup

Can it run on gup? My display cannot be compiled on gpu thanks

Segmentation fault (core dumped)

Error occur as follows when i running python main.py --model gcn.

(torch110) gzh@root0-SCW4350-4:~/Gabor_CNN_PyTorch/demo$ python main.py --model gcn 
GCN(
  (model): Sequential(
    (0): GConv(1, 10, kernel_size=(4, 5, 5), stride=(1, 1), padding=(2, 2), bias=False)
    (1): BatchNorm2d(40, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): ReLU(inplace)
    (3): GConv(10, 20, kernel_size=(4, 5, 5), stride=(1, 1), padding=(2, 2), bias=False)
    (4): BatchNorm2d(80, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (5): ReLU(inplace)
    (6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (7): GConv(20, 40, kernel_size=(4, 5, 5), stride=(1, 1), bias=False)
    (8): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (9): ReLU(inplace)
    (10): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (11): GConv(40, 80, kernel_size=(4, 5, 5), stride=(1, 1), bias=False)
    (12): BatchNorm2d(320, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (13): ReLU(inplace)
  )
  (fc1): Linear(in_features=80, out_features=1024, bias=True)
  (relu): ReLU(inplace)
  (dropout): Dropout(p=0.5)
  (fc2): Linear(in_features=1024, out_features=10, bias=True)
)
/home/gzh/Gabor_CNN_PyTorch/gcn/layers/GConv.py:71: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  for i in range(x.size(1)):
Segmentation fault (core dumped)

It's hard to find out the bug, i met the Segmentation fault several times, all of it is because the environment mismatch.
May someone who can successfully running the main.py share the python environment with me? (e.g. using command pip freeze > pack_env.txt can output your python package) And my environment shown as follows. Or someone who known how to fix it, please tell me. Thanks a lot~

absl-py==0.7.1
certifi==2016.2.28
future==0.17.1
-e git+https://github.com/jxgu1016/Gabor_CNN_PyTorch@c2621f5080e99202ee2e1f4dd116c1b0ef8928dc#egg=gcn
grpcio==1.20.1
Markdown==3.1
numpy==1.16.3
Pillow==6.0.0
protobuf==3.7.1
PySnooper==0.0.33
six==1.12.0
tb-nightly==1.14.0a20190508
torch==1.1.0
torchvision==0.2.2.post3
Werkzeug==0.15.2

Error occur when run gcn/modules/Gconv.py

When I run gcn/modules/Gconv.py

I modify the following :
1.) line 9
from .utils import _pair -> from utils import _pair
2.) line 64
for i in range(bias.size()): -> for i in range(bias.size()[0]):

But it still have error in line 67 which show error message
NameError: global name 'x' is not defined

Can you tell me how to fix it? Thanks!

关于expending的操作

您好,想请教一下,网络在对第一层输入操作的时候有一个expending操作,如果输入是一通道,那么会扩展成重复的四个通道,然后使用一个4通道的卷积核依据论文的方法卷积,最终得到四通道。我想问一下,如果我不扩展直接操作,也就是说直接对一通道卷积核做四个方向的扩展,然后分别和输入做卷积,这样同样会得到一个四通道的输出,我认为这两种方式是有区别的,之所以这么思考是因为之后的卷积其实相当于是对卷积核的全部通道先扩展再卷积然后得到输出,这样和分组每组4通道卷积结果上看是一个道理的,但是对于输入来说expending这一步貌似是有区别的?您觉得我想的对吗,望指教!(一名15级北航学生谢过)

Error occur whern type "sh install.sh"

Dear jxgu1016,

Here is my system situation :
OS: Windows 10 x64
Pytorch: 0.3.1
CUDA/cuDNN version: cuda8.0 / cuDNN 5.1
GPU: Nvidia GTX 980M

When I run "sh install.sh" in git bash,I got:
$ sh install.sh
Compiling cuda kernels...
rm: cannot remove 'libgcn_kernel.cu.o': No such file or directory
libgcn_kernel.cu
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
libgcn_kernel.cu
F:/VisualStudio2015/VC/bin/../../VC/INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
Installing extension...
Including CUDA code.
running clean
removing 'build\temp.win-amd64-3.5' (and everything under it)
Including CUDA code.
running install
running bdist_egg
running egg_info
writing dependency_links to gcn.egg-info\dependency_links.txt
writing gcn.egg-info\PKG-INFO
writing requirements to gcn.egg-info\requires.txt
writing top-level names to gcn.egg-info\top_level.txt
reading manifest file 'gcn.egg-info\SOURCES.txt'
writing manifest file 'gcn.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying gcn_ext\libgcn_init_.py -> build\lib.win-amd64-3.5\gcn_ext\libgcn
running build_ext
generating cffi module 'build\temp.win-amd64-3.5\Release\gcn._ext.libgcn._libgcn.c'
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
building 'gcn._ext.libgcn._libgcn' extension
creating build\temp.win-amd64-3.5\Release\build
creating build\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\PythonCode
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch\Palm
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch\Palm\GCN_1
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch\Palm\GCN_1\Gabor_CNN_PyTorch
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch\Palm\GCN_1\Gabor_CNN_PyTorch\gcn
creating build\temp.win-amd64-3.5\Release\PythonCode\Pytorch\Palm\GCN_1\Gabor_CNN_PyTorch\gcn\src
F:\VisualStudio2015\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWITH_CUDA -IE:\Anaconda3\lib\site-packages\torch\utils\ffi....\lib\include -IE:\Anaconda3\lib\site-packages\torch\utils\ffi....\lib\include\TH -IE:\Anaconda3\lib\site-packages\torch\utils\ffi....\lib\include\THC -Igcn/src -IE:\Anaconda3\include -IE:\Anaconda3\include -IF:\VisualStudio2015\VC\INCLUDE -IF:\VisualStudio2015\VC\ATLMFC\INCLUDE "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcbuild\temp.win-amd64-3.5\Release\gcn._ext.libgcn._libgcn.c /Fobuild\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5\Release\gcn._ext.libgcn._libgcn.obj -fopenmp
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
gcn._ext.libgcn._libgcn.c
e:\anaconda3\lib\site-packages\torch\lib\include\thc\THCGeneral.h(9): fatal error C1083: Cannot open include file: 'cuda.h': No such file or directory
error: command 'F:\VisualStudio2015\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

Can you tell me how to solve it?
My sincere thanks!

run on gup

Can it run on gup? My display cannot be compiled on gpu thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.