diff --git a/.gitignore b/.gitignore index 054598de1..eba746126 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,3 @@ data/* *.pyc *~ -/images - Copy -*.pyd -*.ipch -*.tlog -*.deps -*.cache -*.obj -*.log -*.pdb -/vgg16_caffe.pth -/windows/.vs/faster_rcnn/v15 -*.dll -*.lib -/.vs/FasterRCNN/v15 diff --git a/FasterRCNN.pyproj b/FasterRCNN.pyproj deleted file mode 100644 index 882391117..000000000 --- a/FasterRCNN.pyproj +++ /dev/null @@ -1,6074 +0,0 @@ - - - - Debug - 2.0 - {331bac87-6d9d-4023-954a-0a35943a3358} - - demo.py - lib - . - . - {888888a0-9f3d-457c-b088-3a5042f75d52} - Standard Python launcher - - --cuda - False - - - - - 10.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/FasterRCNN.sln b/FasterRCNN.sln deleted file mode 100644 index bc6c24646..000000000 --- a/FasterRCNN.sln +++ /dev/null @@ -1,23 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "FasterRCNN", "FasterRCNN.pyproj", "{331BAC87-6D9D-4023-954A-0A35943A3358}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {331BAC87-6D9D-4023-954A-0A35943A3358}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {331BAC87-6D9D-4023-954A-0A35943A3358}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4969271A-7E02-44A8-B9CD-00F0B4151CC0} - EndGlobalSection -EndGlobal diff --git a/README.md b/README.md index 298088e22..cc305e4ae 100644 --- a/README.md +++ b/README.md @@ -149,10 +149,8 @@ Install all the python dependencies using pip: pip install -r requirements.txt ``` -if bulid on windows, please click [README.md](./windows/README.md). - -else compile the cuda dependencies using following simple commands: - +Compile the cuda dependencies using following simple commands: + ``` cd lib sh make.sh diff --git a/demo.py b/demo.py index 6f59dba93..51670b43a 100644 --- a/demo.py +++ b/demo.py @@ -55,13 +55,13 @@ def parse_args(): default='cfgs/vgg16.yml', type=str) parser.add_argument('--net', dest='net', help='vgg16, res50, res101, res152', - default='vgg16', type=str) + default='res101', type=str) parser.add_argument('--set', dest='set_cfgs', help='set config keys', default=None, nargs=argparse.REMAINDER) parser.add_argument('--load_dir', dest='load_dir', help='directory to load models', - default="F:/Pascal/faster_rcnn_pytorch") + default="/srv/share/jyang375/models") parser.add_argument('--image_dir', dest='image_dir', help='directory to load images for demo', default="images") diff --git a/images/img1_det.jpg b/images/img1_det.jpg index dbf9aa71f..099b0e4f9 100644 Binary files a/images/img1_det.jpg and b/images/img1_det.jpg differ diff --git a/images/img1_det_res101.jpg b/images/img1_det_res101.jpg new file mode 100644 index 000000000..099b0e4f9 Binary files /dev/null and b/images/img1_det_res101.jpg differ diff --git a/images/img2.jpg b/images/img2.jpg new file mode 100644 index 000000000..d8329671d Binary files /dev/null and b/images/img2.jpg differ diff --git a/images/img2_det.jpg b/images/img2_det.jpg new file mode 100644 index 000000000..e70318337 Binary files /dev/null and b/images/img2_det.jpg differ diff --git a/images/img2_det_res101.jpg b/images/img2_det_res101.jpg new file mode 100644 index 000000000..e70318337 Binary files /dev/null and b/images/img2_det_res101.jpg differ diff --git a/images/img3.jpg b/images/img3.jpg new file mode 100644 index 000000000..832688c15 Binary files /dev/null and b/images/img3.jpg differ diff --git a/images/img3_det.jpg b/images/img3_det.jpg new file mode 100644 index 000000000..a754cb932 Binary files /dev/null and b/images/img3_det.jpg differ diff --git a/images/img3_det_res101.jpg b/images/img3_det_res101.jpg new file mode 100644 index 000000000..a754cb932 Binary files /dev/null and b/images/img3_det_res101.jpg differ diff --git a/images/img4_det.jpg b/images/img4_det.jpg index ed0430194..e77477728 100644 Binary files a/images/img4_det.jpg and b/images/img4_det.jpg differ diff --git a/images/img4_det_res101.jpg b/images/img4_det_res101.jpg new file mode 100644 index 000000000..e77477728 Binary files /dev/null and b/images/img4_det_res101.jpg differ diff --git a/lib/make.sh b/lib/make.sh index d3bb0fb4c..7885d3fc0 100755 --- a/lib/make.sh +++ b/lib/make.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -CUDA_PATH="A:/NVIDIA/GPU Computing Toolkit/CUDA/v9.1" +CUDA_PATH=/usr/local/cuda/ python setup.py build_ext --inplace rm -rf build @@ -15,8 +15,8 @@ CUDA_ARCH="-gencode arch=compute_30,code=sm_30 \ # compile NMS cd model/nms/src echo "Compiling nms kernels by nvcc..." -#nvcc -c -o nms_cuda_kernel.lib nms_cuda_kernel.cu \ -# -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH +nvcc -c -o nms_cuda_kernel.cu.o nms_cuda_kernel.cu \ + -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH cd ../ python build.py @@ -25,8 +25,8 @@ python build.py cd ../../ cd model/roi_pooling/src echo "Compiling roi pooling kernels by nvcc..." -#nvcc -c -o roi_pooling.lib roi_pooling_kernel.cu \ -# -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH +nvcc -c -o roi_pooling.cu.o roi_pooling_kernel.cu \ + -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH cd ../ python build.py @@ -34,8 +34,8 @@ python build.py cd ../../ cd model/roi_align/src echo "Compiling roi align kernels by nvcc..." -#nvcc -c -o roi_align_kernel.lib roi_align_kernel.cu \ -# -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH +nvcc -c -o roi_align_kernel.cu.o roi_align_kernel.cu \ + -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH cd ../ python build.py @@ -43,7 +43,7 @@ python build.py cd ../../ cd model/roi_crop/src echo "Compiling roi crop kernels by nvcc..." -#nvcc -c -o roi_crop_cuda_kernel.lib roi_crop_cuda_kernel.cu \ -# -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH +nvcc -c -o roi_crop_cuda_kernel.cu.o roi_crop_cuda_kernel.cu \ + -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CUDA_ARCH cd ../ python build.py diff --git a/lib/model/nms/_ext/nms/__init__.py b/lib/model/nms/_ext/nms/__init__.py index d71786fda..d73a031ae 100644 --- a/lib/model/nms/_ext/nms/__init__.py +++ b/lib/model/nms/_ext/nms/__init__.py @@ -6,10 +6,7 @@ def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) - if callable(fn): - locals[symbol] = _wrap_function(fn, _ffi) - else: - locals[symbol] = fn + locals[symbol] = _wrap_function(fn, _ffi) __all__.append(symbol) _import_symbols(locals()) diff --git a/lib/model/nms/build.py b/lib/model/nms/build.py index 0acc52b3b..4f0a6659f 100644 --- a/lib/model/nms/build.py +++ b/lib/model/nms/build.py @@ -1,36 +1,25 @@ from __future__ import print_function import os -import sys import torch from torch.utils.ffi import create_extension #this_file = os.path.dirname(__file__) -torch_root = os.path.join(os.path.dirname(sys.executable), - 'Lib/site-packages/torch/lib') -cuda_root = os.environ['CUDA_PATH'] sources = [] headers = [] defines = [] -include_dirs = [] with_cuda = False -this_file = os.path.dirname(os.path.realpath(__file__)) -print(this_file) - if torch.cuda.is_available(): print('Including CUDA code.') - sources += ['src/nms_cuda.cpp'] + sources += ['src/nms_cuda.c'] headers += ['src/nms_cuda.h'] - include_dirs += [os.path.join(cuda_root,"include"), os.path.join(torch_root,'include')] defines += [('WITH_CUDA', None)] with_cuda = True - -extra_objects = ['src/nms_cuda_kernel.lib'] -extra_objects += [os.path.join(torch_root,'ATen.lib'), - os.path.join(cuda_root,'lib/x64/cudart.lib'), - os.path.join(torch_root,'_C.lib')] +this_file = os.path.dirname(os.path.realpath(__file__)) +print(this_file) +extra_objects = ['src/nms_cuda_kernel.cu.o'] extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] print(extra_objects) @@ -41,8 +30,7 @@ define_macros=defines, relative_to=__file__, with_cuda=with_cuda, - extra_objects=extra_objects, - include_dirs=include_dirs + extra_objects=extra_objects ) if __name__ == '__main__': diff --git a/lib/model/nms/src/nms_cuda.c b/lib/model/nms/src/nms_cuda.c new file mode 100644 index 000000000..9bb840755 --- /dev/null +++ b/lib/model/nms/src/nms_cuda.c @@ -0,0 +1,19 @@ +#include +#include +#include "nms_cuda_kernel.h" + +// this symbol will be resolved automatically from PyTorch libs +extern THCState *state; + +int nms_cuda(THCudaIntTensor *keep_out, THCudaTensor *boxes_host, + THCudaIntTensor *num_out, float nms_overlap_thresh) { + + nms_cuda_compute(THCudaIntTensor_data(state, keep_out), + THCudaIntTensor_data(state, num_out), + THCudaTensor_data(state, boxes_host), + boxes_host->size[0], + boxes_host->size[1], + nms_overlap_thresh); + + return 1; +} diff --git a/lib/model/nms/src/nms_cuda.h b/lib/model/nms/src/nms_cuda.h index c862ac789..e85559a49 100644 --- a/lib/model/nms/src/nms_cuda.h +++ b/lib/model/nms/src/nms_cuda.h @@ -1,4 +1,5 @@ // int nms_cuda(THCudaTensor *keep_out, THCudaTensor *num_out, // THCudaTensor *boxes_host, THCudaTensor *nms_overlap_thresh); + int nms_cuda(THCudaIntTensor *keep_out, THCudaTensor *boxes_host, THCudaIntTensor *num_out, float nms_overlap_thresh); diff --git a/lib/model/roi_align/_ext/roi_align/__init__.py b/lib/model/roi_align/_ext/roi_align/__init__.py index c5b6e5d54..c48069106 100644 --- a/lib/model/roi_align/_ext/roi_align/__init__.py +++ b/lib/model/roi_align/_ext/roi_align/__init__.py @@ -6,10 +6,7 @@ def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) - if callable(fn): - locals[symbol] = _wrap_function(fn, _ffi) - else: - locals[symbol] = fn + locals[symbol] = _wrap_function(fn, _ffi) __all__.append(symbol) _import_symbols(locals()) diff --git a/lib/model/roi_align/build.py b/lib/model/roi_align/build.py index a31d30c28..79f9586c2 100644 --- a/lib/model/roi_align/build.py +++ b/lib/model/roi_align/build.py @@ -1,17 +1,13 @@ from __future__ import print_function import os -import sys import torch from torch.utils.ffi import create_extension - -torch_root = os.path.join(os.path.dirname(sys.executable), - 'Lib/site-packages/torch/lib') -cuda_root = os.environ['CUDA_PATH'] - -sources = ['src/roi_align.cpp'] +sources = ['src/roi_align.c'] headers = ['src/roi_align.h'] -include_dirs = [] +extra_objects = [] +#sources = [] +#headers = [] defines = [] with_cuda = False @@ -20,18 +16,13 @@ if torch.cuda.is_available(): print('Including CUDA code.') - sources += ['src/roi_align_cuda.cpp'] + sources += ['src/roi_align_cuda.c'] headers += ['src/roi_align_cuda.h'] defines += [('WITH_CUDA', None)] with_cuda = True - include_dirs += [os.path.join(cuda_root,"include"), - os.path.join(torch_root,'include')] -extra_objects = ['src/roi_align_kernel.lib'] -extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] -extra_objects += [os.path.join(torch_root,'ATen.lib'), - os.path.join(cuda_root,'lib/x64/cudart.lib'), - os.path.join(torch_root,'_C.lib')] -print(extra_objects) + + extra_objects = ['src/roi_align_kernel.cu.o'] + extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] ffi = create_extension( '_ext.roi_align', @@ -40,8 +31,7 @@ define_macros=defines, relative_to=__file__, with_cuda=with_cuda, - extra_objects=extra_objects, - include_dirs=include_dirs + extra_objects=extra_objects ) if __name__ == '__main__': diff --git a/lib/model/roi_align/src/roi_align.cpp b/lib/model/roi_align/src/roi_align.c similarity index 97% rename from lib/model/roi_align/src/roi_align.cpp rename to lib/model/roi_align/src/roi_align.c index ca984852b..681daca71 100644 --- a/lib/model/roi_align/src/roi_align.cpp +++ b/lib/model/roi_align/src/roi_align.c @@ -13,7 +13,7 @@ void ROIAlignBackwardCpu(const float* top_diff, const float spatial_scale, const const int aligned_height, const int aligned_width, const float * bottom_rois, float* top_data); -extern"C" __declspec(dllexport) int roi_align_forward(int aligned_height, int aligned_width, float spatial_scale, +int roi_align_forward(int aligned_height, int aligned_width, float spatial_scale, THFloatTensor * features, THFloatTensor * rois, THFloatTensor * output) { //Grab the input tensor @@ -44,7 +44,7 @@ extern"C" __declspec(dllexport) int roi_align_forward(int aligned_height, int al return 1; } -extern"C" __declspec(dllexport) int roi_align_backward(int aligned_height, int aligned_width, float spatial_scale, +int roi_align_backward(int aligned_height, int aligned_width, float spatial_scale, THFloatTensor * top_grad, THFloatTensor * rois, THFloatTensor * bottom_grad) { //Grab the input tensor diff --git a/lib/model/roi_align/src/roi_align_cuda.cpp b/lib/model/roi_align/src/roi_align_cuda.c similarity index 87% rename from lib/model/roi_align/src/roi_align_cuda.cpp rename to lib/model/roi_align/src/roi_align_cuda.c index 70bdee051..0644fc600 100644 --- a/lib/model/roi_align/src/roi_align_cuda.cpp +++ b/lib/model/roi_align/src/roi_align_cuda.c @@ -1,11 +1,10 @@ #include #include -#include #include "roi_align_kernel.h" -THCState *state = at::globalContext().thc_state; +extern THCState *state; -extern"C" __declspec(dllexport) int roi_align_forward_cuda(int aligned_height, int aligned_width, float spatial_scale, +int roi_align_forward_cuda(int aligned_height, int aligned_width, float spatial_scale, THCudaTensor * features, THCudaTensor * rois, THCudaTensor * output) { // Grab the input tensor @@ -40,7 +39,7 @@ extern"C" __declspec(dllexport) int roi_align_forward_cuda(int aligned_height, i return 1; } -extern"C" __declspec(dllexport) int roi_align_backward_cuda(int aligned_height, int aligned_width, float spatial_scale, +int roi_align_backward_cuda(int aligned_height, int aligned_width, float spatial_scale, THCudaTensor * top_grad, THCudaTensor * rois, THCudaTensor * bottom_grad) { // Grab the input tensor diff --git a/lib/model/roi_crop/_ext/roi_crop/__init__.py b/lib/model/roi_crop/_ext/roi_crop/__init__.py index a6423514e..35d40549a 100644 --- a/lib/model/roi_crop/_ext/roi_crop/__init__.py +++ b/lib/model/roi_crop/_ext/roi_crop/__init__.py @@ -6,10 +6,7 @@ def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) - if callable(fn): - locals[symbol] = _wrap_function(fn, _ffi) - else: - locals[symbol] = fn + locals[symbol] = _wrap_function(fn, _ffi) __all__.append(symbol) _import_symbols(locals()) diff --git a/lib/model/roi_crop/build.py b/lib/model/roi_crop/build.py index 4db09204e..964055a4b 100644 --- a/lib/model/roi_crop/build.py +++ b/lib/model/roi_crop/build.py @@ -1,38 +1,26 @@ from __future__ import print_function import os -import sys import torch from torch.utils.ffi import create_extension #this_file = os.path.dirname(__file__) -torch_root = os.path.join(os.path.dirname(sys.executable), - 'Lib/site-packages/torch/lib') -cuda_root = os.environ['CUDA_PATH'] -sources = ['src/roi_crop.cpp'] +sources = ['src/roi_crop.c'] headers = ['src/roi_crop.h'] -include_dirs = [] defines = [] with_cuda = False -this_file = os.path.dirname(os.path.realpath(__file__)) -print(this_file) - if torch.cuda.is_available(): print('Including CUDA code.') - sources += ['src/roi_crop_cuda.cpp'] + sources += ['src/roi_crop_cuda.c'] headers += ['src/roi_crop_cuda.h'] - include_dirs += [os.path.join(cuda_root,"include"), - os.path.join(torch_root,'include')] defines += [('WITH_CUDA', None)] with_cuda = True -extra_objects = ['src/roi_crop_cuda_kernel.lib'] +this_file = os.path.dirname(os.path.realpath(__file__)) +print(this_file) +extra_objects = ['src/roi_crop_cuda_kernel.cu.o'] extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] -extra_objects += [os.path.join(torch_root,'ATen.lib'), - os.path.join(cuda_root,'lib/x64/cudart.lib'), - os.path.join(torch_root,'_C.lib')] -print(extra_objects) ffi = create_extension( '_ext.roi_crop', @@ -41,8 +29,7 @@ define_macros=defines, relative_to=__file__, with_cuda=with_cuda, - extra_objects=extra_objects, - include_dirs=include_dirs + extra_objects=extra_objects ) if __name__ == '__main__': diff --git a/lib/model/roi_crop/src/roi_crop.cpp b/lib/model/roi_crop/src/roi_crop.c similarity index 97% rename from lib/model/roi_crop/src/roi_crop.cpp rename to lib/model/roi_crop/src/roi_crop.c index 044e0fab3..81f5fb44a 100644 --- a/lib/model/roi_crop/src/roi_crop.cpp +++ b/lib/model/roi_crop/src/roi_crop.c @@ -4,7 +4,7 @@ #define real float -extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) +int BilinearSamplerBHWD_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) { int batchsize = inputImages->size[0]; @@ -102,7 +102,7 @@ extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateOutput(THFloatTens -extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, +int BilinearSamplerBHWD_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, THFloatTensor *gradGrids, THFloatTensor *gradOutput) { bool onlyGrid=false; @@ -243,7 +243,7 @@ extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateGradInput(THFloatT } -extern"C" __declspec(dllexport) int BilinearSamplerBCHW_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) +int BilinearSamplerBCHW_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) { int batchsize = inputImages->size[0]; @@ -347,7 +347,7 @@ extern"C" __declspec(dllexport) int BilinearSamplerBCHW_updateOutput(THFloatTens -extern"C" __declspec(dllexport) int BilinearSamplerBCHW_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, +int BilinearSamplerBCHW_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, THFloatTensor *gradGrids, THFloatTensor *gradOutput) { bool onlyGrid=false; diff --git a/lib/model/roi_crop/src/roi_crop_cuda.cpp b/lib/model/roi_crop/src/roi_crop_cuda.c similarity index 94% rename from lib/model/roi_crop/src/roi_crop_cuda.cpp rename to lib/model/roi_crop/src/roi_crop_cuda.c index 8a8e7db49..a6d8d803e 100644 --- a/lib/model/roi_crop/src/roi_crop_cuda.cpp +++ b/lib/model/roi_crop/src/roi_crop_cuda.c @@ -1,19 +1,18 @@ #include #include -#include #include #include "roi_crop_cuda_kernel.h" #define real float // this symbol will be resolved automatically from PyTorch libs -THCState *state = at::globalContext().thc_state; +extern THCState *state; // Bilinear sampling is done in BHWD (coalescing is not obvious in BDHW) // we assume BHWD format in inputImages // we assume BHW(YX) format on grids -extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateOutput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *output){ +int BilinearSamplerBHWD_updateOutput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *output){ // THCState *state = getCutorchState(L); // THCudaTensor *inputImages = (THCudaTensor *)luaT_checkudata(L, 2, "torch.CudaTensor"); // THCudaTensor *grids = (THCudaTensor *)luaT_checkudata(L, 3, "torch.CudaTensor"); @@ -52,7 +51,7 @@ extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateOutput_cuda(THCuda return 1; } -extern"C" __declspec(dllexport) int BilinearSamplerBHWD_updateGradInput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *gradInputImages, +int BilinearSamplerBHWD_updateGradInput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *gradInputImages, THCudaTensor *gradGrids, THCudaTensor *gradOutput) { // THCState *state = getCutorchState(L); diff --git a/lib/model/roi_pooling/_ext/roi_pooling/__init__.py b/lib/model/roi_pooling/_ext/roi_pooling/__init__.py index d900ec5a4..9da23b18f 100644 --- a/lib/model/roi_pooling/_ext/roi_pooling/__init__.py +++ b/lib/model/roi_pooling/_ext/roi_pooling/__init__.py @@ -6,10 +6,7 @@ def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) - if callable(fn): - locals[symbol] = _wrap_function(fn, _ffi) - else: - locals[symbol] = fn + locals[symbol] = _wrap_function(fn, _ffi) __all__.append(symbol) _import_symbols(locals()) diff --git a/lib/model/roi_pooling/build.py b/lib/model/roi_pooling/build.py index fbfd4877c..9401bff6d 100644 --- a/lib/model/roi_pooling/build.py +++ b/lib/model/roi_pooling/build.py @@ -1,17 +1,12 @@ from __future__ import print_function import os -import sys import torch from torch.utils.ffi import create_extension -torch_root = os.path.join(os.path.dirname(sys.executable), - 'Lib/site-packages/torch/lib') -cuda_root = os.environ['CUDA_PATH'] - -sources = ['src/roi_pooling.cpp'] +sources = ['src/roi_pooling.c'] headers = ['src/roi_pooling.h'] -include_dirs = [] +extra_objects = [] defines = [] with_cuda = False @@ -20,19 +15,12 @@ if torch.cuda.is_available(): print('Including CUDA code.') - sources += ['src/roi_pooling_cuda.cpp'] + sources += ['src/roi_pooling_cuda.c'] headers += ['src/roi_pooling_cuda.h'] - include_dirs += [os.path.join(cuda_root,"include"), - os.path.join(torch_root,'include')] defines += [('WITH_CUDA', None)] with_cuda = True - -extra_objects = ['src/roi_pooling.lib'] -extra_objects += [os.path.join(torch_root,'ATen.lib'), - os.path.join(cuda_root,'lib/x64/cudart.lib'), - os.path.join(torch_root,'_C.lib')] -extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] -print(extra_objects) + extra_objects = ['src/roi_pooling.cu.o'] + extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] ffi = create_extension( '_ext.roi_pooling', @@ -41,8 +29,7 @@ define_macros=defines, relative_to=__file__, with_cuda=with_cuda, - extra_objects=extra_objects, - include_dirs=include_dirs + extra_objects=extra_objects ) if __name__ == '__main__': diff --git a/lib/model/roi_pooling/src/roi_pooling.cpp b/lib/model/roi_pooling/src/roi_pooling.c similarity index 97% rename from lib/model/roi_pooling/src/roi_pooling.cpp rename to lib/model/roi_pooling/src/roi_pooling.c index 4bfb3dcb2..47a754d66 100644 --- a/lib/model/roi_pooling/src/roi_pooling.cpp +++ b/lib/model/roi_pooling/src/roi_pooling.c @@ -1,7 +1,7 @@ #include #include -extern"C" __declspec(dllexport) int roi_pooling_forward(int pooled_height, int pooled_width, float spatial_scale, +int roi_pooling_forward(int pooled_height, int pooled_width, float spatial_scale, THFloatTensor * features, THFloatTensor * rois, THFloatTensor * output) { // Grab the input tensor diff --git a/lib/model/roi_pooling/src/roi_pooling_cuda.cpp b/lib/model/roi_pooling/src/roi_pooling_cuda.c similarity index 89% rename from lib/model/roi_pooling/src/roi_pooling_cuda.cpp rename to lib/model/roi_pooling/src/roi_pooling_cuda.c index e8ac00a43..32eb3f774 100644 --- a/lib/model/roi_pooling/src/roi_pooling_cuda.cpp +++ b/lib/model/roi_pooling/src/roi_pooling_cuda.c @@ -1,11 +1,10 @@ #include #include -#include #include "roi_pooling_kernel.h" -THCState *state = at::globalContext().thc_state; +extern THCState *state; -extern"C" __declspec(dllexport) int roi_pooling_forward_cuda(int pooled_height, int pooled_width, float spatial_scale, +int roi_pooling_forward_cuda(int pooled_height, int pooled_width, float spatial_scale, THCudaTensor * features, THCudaTensor * rois, THCudaTensor * output, THCudaIntTensor * argmax) { // Grab the input tensor @@ -47,7 +46,7 @@ extern"C" __declspec(dllexport) int roi_pooling_forward_cuda(int pooled_height, return 1; } -extern"C" __declspec(dllexport) int roi_pooling_backward_cuda(int pooled_height, int pooled_width, float spatial_scale, +int roi_pooling_backward_cuda(int pooled_height, int pooled_width, float spatial_scale, THCudaTensor * top_grad, THCudaTensor * rois, THCudaTensor * bottom_grad, THCudaIntTensor * argmax) { // Grab the input tensor diff --git a/lib/model/rpn/anchor_target_layer.py b/lib/model/rpn/anchor_target_layer.py index 9a8eb6444..515cce8c5 100644 --- a/lib/model/rpn/anchor_target_layer.py +++ b/lib/model/rpn/anchor_target_layer.py @@ -153,7 +153,7 @@ def forward(self, input): bbox_inside_weights[labels==1] = cfg.TRAIN.RPN_BBOX_INSIDE_WEIGHTS[0] if cfg.TRAIN.RPN_POSITIVE_WEIGHT < 0: - num_examples = torch.sum(labels[i] >= 0).item() + num_examples = torch.sum(labels[i] >= 0) positive_weights = 1.0 / num_examples negative_weights = 1.0 / num_examples else: diff --git a/lib/model/rpn/proposal_target_layer_cascade.py b/lib/model/rpn/proposal_target_layer_cascade.py index 47534f0e5..5cdfa3837 100644 --- a/lib/model/rpn/proposal_target_layer_cascade.py +++ b/lib/model/rpn/proposal_target_layer_cascade.py @@ -130,7 +130,7 @@ def _sample_rois_pytorch(self, all_rois, gt_boxes, fg_rois_per_image, rois_per_i offset = torch.arange(0, batch_size)*gt_boxes.size(1) offset = offset.view(-1, 1).type_as(gt_assignment) + gt_assignment - labels = gt_boxes[:,:,4].contiguous().view(-1).index((offset.view(-1),))\ + labels = gt_boxes[:,:,4].contiguous().view(-1).index(offset.view(-1))\ .view(batch_size, -1) labels_batch = labels.new(batch_size, rois_per_image).zero_() diff --git a/lib/model/utils/net_utils.py b/lib/model/utils/net_utils.py index 8fd326948..c21c73951 100644 --- a/lib/model/utils/net_utils.py +++ b/lib/model/utils/net_utils.py @@ -45,7 +45,6 @@ def clip_gradient(model, clip_norm): totalnorm = np.sqrt(totalnorm) norm = clip_norm / max(totalnorm, clip_norm) - norm = torch.tensor([norm],device='cuda') for p in model.parameters(): if p.requires_grad: p.grad.mul_(norm) diff --git a/lib/setup.py b/lib/setup.py index a188850d8..34ba4b728 100644 --- a/lib/setup.py +++ b/lib/setup.py @@ -77,34 +77,32 @@ def customize_compiler_for_nvcc(self): subclassing going on.""" # tell the compiler it can processes .cu - #self.src_extensions.append('.cu') + self.src_extensions.append('.cu') # save references to the default compiler_so and _comple methods - #default_compiler_so = self.spawn - #default_compiler_so = self.rc - super = self.compile + default_compiler_so = self.compiler_so + super = self._compile # now redefine the _compile method. This gets executed for each # object but distutils doesn't have the ability to change compilers # based on source extension: we add it. - def compile(sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None): - postfix=os.path.splitext(sources[0])[1] - - if postfix == '.cu': + def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts): + print(extra_postargs) + if os.path.splitext(src)[1] == '.cu': # use the cuda for .cu files - #self.set_executable('compiler_so', CUDA['nvcc']) + self.set_executable('compiler_so', CUDA['nvcc']) # use only a subset of the extra_postargs, which are 1-1 translated # from the extra_compile_args in the Extension class postargs = extra_postargs['nvcc'] else: postargs = extra_postargs['gcc'] - return super(sources, output_dir, macros, include_dirs, debug, extra_preargs, postargs, depends) + super(obj, src, ext, cc_args, postargs, pp_opts) # reset the default compiler_so, which we might have changed for cuda - #self.rc = default_compiler_so + self.compiler_so = default_compiler_so # inject our redefined _compile method into the class - self.compile = compile + self._compile = _compile # run the customize_compiler @@ -118,7 +116,7 @@ def build_extensions(self): Extension( "model.utils.cython_bbox", ["model/utils/bbox.pyx"], - extra_compile_args={'gcc': []}, + extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]}, include_dirs=[numpy_include] ), Extension( @@ -126,7 +124,7 @@ def build_extensions(self): sources=['pycocotools/maskApi.c', 'pycocotools/_mask.pyx'], include_dirs=[numpy_include, 'pycocotools'], extra_compile_args={ - 'gcc': ['/Qstd=c99']}, + 'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']}, ), ] diff --git a/test_net.py b/test_net.py index 2e8a18f8b..d9881263f 100644 --- a/test_net.py +++ b/test_net.py @@ -57,7 +57,7 @@ def parse_args(): help='set config keys', default=None, nargs=argparse.REMAINDER) parser.add_argument('--load_dir', dest='load_dir', - help='directory to load models', default="F:/Pascal/faster_rcnn_pytorch", + help='directory to load models', default="/srv/share/jyang375/models", type=str) parser.add_argument('--cuda', dest='cuda', help='whether use CUDA', diff --git a/trainval_net.py b/trainval_net.py index 6e7932ef5..777254ddc 100644 --- a/trainval_net.py +++ b/trainval_net.py @@ -58,7 +58,7 @@ def parse_args(): default=10000, type=int) parser.add_argument('--save_dir', dest='save_dir', - help='directory to save models', default="F:/Pascal/faster_rcnn_pytorch", + help='directory to save models', default="/srv/share/jyang375/models", type=str) parser.add_argument('--nw', dest='num_workers', help='number of worker to load data', diff --git a/windows/Microsoft.VCToolsVersion.14.11.props b/windows/Microsoft.VCToolsVersion.14.11.props deleted file mode 100644 index c21f2ea68..000000000 --- a/windows/Microsoft.VCToolsVersion.14.11.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - 14.11.25503 - - diff --git a/windows/README.md b/windows/README.md deleted file mode 100644 index 2c59b7608..000000000 --- a/windows/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Install on windows -## Environment required -- Visual Studio 2017 -- CUDA 9.1 -- Torch 0.4 - -## Install -- git clone this project -- git checkout windows -- Generate cython_bbox.cp36-win_amd64.pyd and _mask.cp36-win_amd64.pyd -``` - cd lib -python setup.py build_ext --inplace -``` -- Open windows/faster_rcnn.sln -- Configured release/x64 for each of project(Debug was not configured) -- Bulid all project in this solution to generate _num.pyd,_roi_pooling.pyd,_roi_crop.pyd and _roi_align.pyd -- Add path of lib to python model environment, or open FasterRCNN.sln and debug with visual studio 2017 - -## Train and Test and demo -- Please follow the instructions in [README.md](../README.md) - - diff --git a/windows/faster_rcnn.sln b/windows/faster_rcnn.sln deleted file mode 100644 index bfb8438e1..000000000 --- a/windows/faster_rcnn.sln +++ /dev/null @@ -1,48 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nms_cuda_kernel", "nms_cuda_kernel\nms_cuda_kernel.vcxproj", "{36817094-27A6-459D-93E6-90E3BAA54E8F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "roi_pooling", "roi_pooling\roi_pooling.vcxproj", "{3661D15F-7536-4032-A40C-DC2B01D87309}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "roi_align_kernel", "roi_align_kernel\roi_align_kernel.vcxproj", "{59FA4733-A0E8-496B-BE95-C79DDABFFB3A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "roi_crop_cuda_kernel", "roi_crop_cuda_kernel\roi_crop_cuda_kernel.vcxproj", "{8E8F236A-0907-43D8-B965-4598A8D63747}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{81BE613E-93C2-4421-B8B8-BB0F8B11067B}" - ProjectSection(SolutionItems) = preProject - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {36817094-27A6-459D-93E6-90E3BAA54E8F}.Debug|x64.ActiveCfg = Debug|x64 - {36817094-27A6-459D-93E6-90E3BAA54E8F}.Debug|x64.Build.0 = Debug|x64 - {36817094-27A6-459D-93E6-90E3BAA54E8F}.Release|x64.ActiveCfg = Release|x64 - {36817094-27A6-459D-93E6-90E3BAA54E8F}.Release|x64.Build.0 = Release|x64 - {3661D15F-7536-4032-A40C-DC2B01D87309}.Debug|x64.ActiveCfg = Debug|x64 - {3661D15F-7536-4032-A40C-DC2B01D87309}.Debug|x64.Build.0 = Debug|x64 - {3661D15F-7536-4032-A40C-DC2B01D87309}.Release|x64.ActiveCfg = Release|x64 - {3661D15F-7536-4032-A40C-DC2B01D87309}.Release|x64.Build.0 = Release|x64 - {59FA4733-A0E8-496B-BE95-C79DDABFFB3A}.Debug|x64.ActiveCfg = Debug|x64 - {59FA4733-A0E8-496B-BE95-C79DDABFFB3A}.Debug|x64.Build.0 = Debug|x64 - {59FA4733-A0E8-496B-BE95-C79DDABFFB3A}.Release|x64.ActiveCfg = Release|x64 - {59FA4733-A0E8-496B-BE95-C79DDABFFB3A}.Release|x64.Build.0 = Release|x64 - {8E8F236A-0907-43D8-B965-4598A8D63747}.Debug|x64.ActiveCfg = Debug|x64 - {8E8F236A-0907-43D8-B965-4598A8D63747}.Debug|x64.Build.0 = Debug|x64 - {8E8F236A-0907-43D8-B965-4598A8D63747}.Release|x64.ActiveCfg = Release|x64 - {8E8F236A-0907-43D8-B965-4598A8D63747}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4CE26216-8410-4562-87BA-B880790D0E23} - EndGlobalSection -EndGlobal diff --git a/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj b/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj deleted file mode 100644 index 0f2be7a5c..000000000 --- a/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - {36817094-27A6-459D-93E6-90E3BAA54E8F} - nms_cuda_kernel - 10.0.17134.0 - - - - - StaticLibrary - true - MultiByte - v141 - - - StaticLibrary - false - true - MultiByte - v141 - - - - - - - - - - - - - - true - $(SolutionDir)..\lib\model\nms\src - - - $(SolutionDir)..\lib\model\nms\src - - - - Level3 - Disabled - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - - - - - Level3 - MaxSpeed - true - true - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - true - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_52,sm_52;compute_60,sm_60;compute_61,sm_61;%(CodeGeneration) - - - - - - - \ No newline at end of file diff --git a/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj.user b/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj.user deleted file mode 100644 index be2507870..000000000 --- a/windows/nms_cuda_kernel/nms_cuda_kernel.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/windows/roi_align_kernel/roi_align_kernel.vcxproj b/windows/roi_align_kernel/roi_align_kernel.vcxproj deleted file mode 100644 index 28697a02f..000000000 --- a/windows/roi_align_kernel/roi_align_kernel.vcxproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - {59FA4733-A0E8-496B-BE95-C79DDABFFB3A} - roi_align_kernel - 10.0.17134.0 - - - - Application - true - MultiByte - v141 - - - StaticLibrary - false - true - MultiByte - v141 - - - - - - - - - - - - - - - true - $(SolutionDir)..\lib\model\roi_align\src - - - $(SolutionDir)..\lib\model\roi_align\src - - - - Level3 - Disabled - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - - - - - Level3 - MaxSpeed - true - true - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - true - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_52,sm_52;compute_60,sm_60;compute_61,sm_61;%(CodeGeneration) - - - - - - - \ No newline at end of file diff --git a/windows/roi_align_kernel/roi_align_kernel.vcxproj.user b/windows/roi_align_kernel/roi_align_kernel.vcxproj.user deleted file mode 100644 index be2507870..000000000 --- a/windows/roi_align_kernel/roi_align_kernel.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj b/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj deleted file mode 100644 index 8acdf4cf2..000000000 --- a/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - {8E8F236A-0907-43D8-B965-4598A8D63747} - roi_crop_cuda_kernel - 10.0.17134.0 - - - - Application - true - MultiByte - v141 - - - StaticLibrary - false - true - MultiByte - v141 - - - - - - - - - - - - - - - true - $(ProjectName) - $(SolutionDir)..\lib\model\roi_crop\src - - - $(SolutionDir)..\lib\model\roi_crop\src - - - - Level3 - Disabled - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - - - - - Level3 - MaxSpeed - true - true - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - true - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_52,sm_52;compute_60,sm_60;compute_61,sm_61;%(CodeGeneration) - - - - - - - \ No newline at end of file diff --git a/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj.user b/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj.user deleted file mode 100644 index be2507870..000000000 --- a/windows/roi_crop_cuda_kernel/roi_crop_cuda_kernel.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/windows/roi_pooling/roi_pooling.vcxproj b/windows/roi_pooling/roi_pooling.vcxproj deleted file mode 100644 index 0e602937d..000000000 --- a/windows/roi_pooling/roi_pooling.vcxproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - {3661D15F-7536-4032-A40C-DC2B01D87309} - roi_pooling - 10.0.17134.0 - - - - Application - true - MultiByte - v141 - - - StaticLibrary - false - true - MultiByte - v141 - - - - - - - - - - - - - - - true - - - $(SolutionDir)..\lib\model\roi_pooling\src - - - - Level3 - Disabled - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - - - - - Level3 - MaxSpeed - true - true - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - true - true - Console - cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)" -cd /d "$(OutDir)..\" -python "build.py" - - - 64 - compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_52,sm_52;compute_60,sm_60;compute_61,sm_61;%(CodeGeneration) - - - - - - - \ No newline at end of file diff --git a/windows/roi_pooling/roi_pooling.vcxproj.user b/windows/roi_pooling/roi_pooling.vcxproj.user deleted file mode 100644 index be2507870..000000000 --- a/windows/roi_pooling/roi_pooling.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file