Something on RoIAlign --- basic introduction and implementation
2018-10-22 22:40:09
Paper: Mask RCNN
Code reference: https://github.com/longcw/RoIAlign.pytorch
=====
git clone https://github.com/longcw/RoIAlign.pytorch
cd RoIAlign.pytorch
modify the script install.sh and test.sh into the following way:
#!/usr/bin/env bash CUDA_PATH=/usr/local/cuda echo "Compiling crop_and_resize kernels by nvcc..." cd roi_align/src/cuda $CUDA_PATH/bin/nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_30 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_62,code=sm_62 cd ../../../roi_align python3 build.py cd .. python3 setup.py install #find $CONDA_PREFIX -name roi_align | awk ‘{mkdir $0 "/_ext" }‘ |bash #find $CONDA_PREFIX -name roi_align | awk ‘{print "cp -r roi_align/_ext/* " $0 "/_ext/" }‘ |bash
python3 tests/test.py python3 tests/test2.py python3 tests/crop_and_resize_example.py
then, run the test.sh, you can found this:
[email protected]:/media/wangxiao/b8efbc67-7ea5-476d-9631-70da75f84e2d/reference_code/RoIAlign.pytorch$ sh ./test.sh
/usr/local/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module ‘tensorflow.python.framework.fast_tensor_util‘ does not match runtime version 3.6
return f(*args, **kwds)
pytorch forward and backward start
pytorch forward and backward end
2018-10-22 22:38:28.483699: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-10-22 22:38:28.492705: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-10-22 22:38:28.493019: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.898
pciBusID: 0000:02:00.0
totalMemory: 7.92GiB freeMemory: 6.29GiB
2018-10-22 22:38:28.493047: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1080, pci bus id: 0000:02:00.0, compute capability: 6.1)
2018-10-22 22:38:28.737003: E tensorflow/stream_executor/cuda/cuda_dnn.cc:378] Loaded runtime CuDNN library: 7102 (compatibility version 7100) but source was compiled with 6021 (compatibility version 6000). If using a binary install, upgrade your CuDNN library to match. If building from sources, make sure the library loaded at runtime matches a compatible version specified during compile configuration.
2018-10-22 22:38:28.737107: F tensorflow/core/kernels/conv_ops.cc:667] Check failed: stream->parent()->GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo<T>(), &algorithms)
Aborted
tensor([[[[0., 1., 2.],
[0., 1., 2.],
[0., 1., 2.]]]], grad_fn=<CropAndResizeFunction>)
torch.Size([2, 3, 500, 500])
==
原文地址:https://www.cnblogs.com/wangxiaocvpr/p/9833665.html