CornerNet-Lite
CornerNet-Lite copied to clipboard
Can it support in Windows10?
Can it support in Windows10?
We only tested CornerNet-Lite on Linux and we don't have a Windows machine so I am not sure if the code will run properly on Windows 10.
D:\Python\Python36\lib\site-packages\torch\lib\include\torch\csrc\api\include\torch/torch.h(7): fatal error C1021: invalid preprocessor command 'warning' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
D:\Python\Python36\lib\site-packages\torch\lib\include\torch\csrc\api\include\torch/torch.h(7): fatal error C1021: invalid preprocessor command 'warning' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
I have met the same problem. And couldn't solve it. Anyone can help me? tks.
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
okay. I find the problem and solve it from the Pull requests. modify the four cpp files(bottom_pool.cpp, left_pool.cpp, top_pool.cpp, right_pool.cpp). Just change <torch/torch.h> to <torch/extension.h> will fix it.
okay. I find the problem and solve it from the Pull requests. modify the four cpp files(bottom_pool.cpp, left_pool.cpp, top_pool.cpp, right_pool.cpp). Just change <torch/torch.h> to <torch/extension.h> will fix it.
=========== 1.modify the four cpp files(bottom_pool.cpp, left_pool.cpp, top_pool.cpp, right_pool.cpp). Just change <torch/torch.h> to <torch/extension.h> 2.Also, insted install into user directory, we can build develop insted : #python setup.py install --user python setup.py build develop
THX!!!!
I have met the same problem. And when I modify the four cpp files(bottom_pool.cpp, left_pool.cpp, top_pool.cpp, right_pool.cpp). Just change <torch/torch.h> to <torch/extension.h>,the other error occured: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1171. Can you tell me how to solve it?
I have met the same problem. And when I modify the four cpp files(bottom_pool.cpp, left_pool.cpp, top_pool.cpp, right_pool.cpp). Just change <torch/torch.h> to <torch/extension.h>,the other error occured: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1171. Can you tell me how to solve it?
thx all, i've changed os to CentOS, but i'll try win10 again
Compiling NMS Compile the NMS code which are originally from Faster R-CNN and Soft-NMS.
cd <CornerNet-Lite dir>/core/external make
D:\Tensorflow\pytorch\CornerNet-Lite\core\external>make python setup.py build_ext --inplace Compiling bbox.pyx because it changed. Compiling nms.pyx because it changed. [1/2] Cythonizing bbox.pyx D:\Program Files\Python368\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\Tensorflow\pytorch\CornerNet-Lite\core\external\bbox.pyx tree = Parsing.p_module(s, pxd, full_module_name) [2/2] Cythonizing nms.pyx D:\Program Files\Python368\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\Tensorflow\pytorch\CornerNet-Lite\core\external\nms.pyx tree = Parsing.p_module(s, pxd, full_module_name) running build_ext building 'bbox' extension creating build creating build\temp.win-amd64-3.6 creating build\temp.win-amd64-3.6\Release C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-ID:\Program Files\Python368\lib\site-packages\numpy\core\include" "-ID:\Program Files\Python368\include" "-ID:\Program Files\Python368\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcbbox.c /Fobuild\temp.win-amd64-3.6\Release\bbox.obj -Wno-cpp -Wno-unused-function cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2 make: *** [Makefile:2: all] Error 1
================= Anyone solved bbox and nms-gpu in win10?
https://blog.csdn.net/qq_41895190/article/details/82877883
cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”
============== okay. I find the problem and solve it.
是因为pycocotools不支持windows。 Because pycocotools does not support windows. pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI 打印出如下信息,已经安装成功了。
C:\Users\TengLong>pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI Cloning https://github.com/philferriere/cocoapi.git to c:\users\tenglong\appdata\local\temp\pip-req-build-pkksskme Requirement already satisfied (use --upgrade to upgrade): pycocotools==2.0 from git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI in d:\program files\python368\lib\site-packages Building wheels for collected packages: pycocotools Building wheel for pycocotools (setup.py) ... done Stored in directory: C:\Users\TengLong\AppData\Local\Temp\pip-ephem-wheel-cache-__zczn1n\wheels\69\2b\12\2fa959e49f73d26cff202c2f4e5079096c9c57c8a8509fd75c Successfully built pycocotools
================ "D:\Program Files\Python368\python.exe" D:/Tensorflow/pytorch/CornerNet-Lite/demo.py total parameters: 116969339 loading from D:\Tensorflow\pytorch\CornerNet-Lite\core..\cache\nnet\CornerNet_Saccade\CornerNet_Saccade_500000.pkl
python setup.py build_ext --inplace
Compiling NMS Compile the NMS code which are originally from Faster R-CNN and Soft-NMS.
cd /core/external
make D:\Tensorflow\pytorch\CornerNet-Lite\core\external>make python setup.py build_ext --inplace Compiling bbox.pyx because it changed. Compiling nms.pyx because it changed. [1/2] Cythonizing bbox.pyx D:\Program Files\Python368\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\Tensorflow\pytorch\CornerNet-Lite\core\external\bbox.pyx tree = Parsing.p_module(s, pxd, full_module_name) [2/2] Cythonizing nms.pyx D:\Program Files\Python368\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: D:\Tensorflow\pytorch\CornerNet-Lite\core\external\nms.pyx tree = Parsing.p_module(s, pxd, full_module_name) running build_ext building 'bbox' extension creating build creating build\temp.win-amd64-3.6 creating build\temp.win-amd64-3.6\Release C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-ID:\Program Files\Python368\lib\site-packages\numpy\core\include" "-ID:\Program Files\Python368\include" "-ID:\Program Files\Python368\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcbbox.c /Fobuild\temp.win-amd64-3.6\Release\bbox.obj -Wno-cpp -Wno-unused-function cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2 make: *** [Makefile:2: all] Error 1
================= Anyone solved bbox and nms-gpu in win10?
**
change all extra_compile_args=["-Wno-cpp", "-Wno-unused-function"] to extra_compile_args={'gcc': ['/Qstd=c99']}
and run command ‘python setup.py build_ext --inplace’
but pycocotools for windows is required https://github.com/binhbumpro/pycocotools-window
**
modify core\external\setup.py change all extra_compile_args=["-Wno-cpp", "-Wno-unused-function"] to extra_compile_args={'gcc': ['/Qstd=c99']}
and run command ‘python setup.py build_ext --inplace’
but pycocotools for windows is required https://github.com/binhbumpro/pycocotools-window
win10 omg
RuntimeError: Dimension out of range (expected to be in range of [-4, 3], but got 2559800508416) (maybe_wrap_dim at ..\aten\src\ATen/core/WrapDimMinimal.h:18) (no backtrace available)
Anyone solved bbox and nms-gpu in win10?
Anyone solved bbox and nms-gpu in win10?
modify core\external\setup.py change all extra_compile_args=["-Wno-cpp", "-Wno-unused-function"] to extra_compile_args={'gcc': ['/Qstd=c99']} and run command ‘python setup.py build_ext --inplace’ but pycocotools for windows is required https://github.com/binhbumpro/pycocotools-window
It can probably solve bbox-nms problem. But when running it in win10,I find CornerNet-Squeeze is slower than yolov3.
Anyone solved bbox and nms-gpu in win10?
I solve this soft-nms problem, I wirte a new function(pure python) replace the orign one. 我写了一个一个python 程序替代了原来的soft_nms
this function is a little different from orign one, it return two objects:
def soft_nms(boxes: np.ndarray, sigma: float = 0.5, Nt: float = 0.3, threshold: float = 0.001, method: int = 0): """ :param boxes: 要求两个维度[n,8] n个boxes :param sigma: :param Nt: iou的阈值 :param threshold: :param method: :return: """ n = np.shape(boxes)[0] # 多少个box if n == 0: return None, np.zeros((0, 5))
for i in range(n):
# 遍历boxes数组中的每个box, 指针每指向一个box后,
# 这个box会和数组后面的全部box(index比他大的box)做比较, 找到得分最大的box
# 用最大box坐标信息和得分与当前指针位置的box的坐标信息和得分,互相交换
# 然后指针后移开始计算下一个box
maxscore = boxes[i, 4] # index = 4 的位置上是 box的得分
maxpos = i # 最大得分的位置
tx1 = boxes[i, 0]
ty1 = boxes[i, 1]
tx2 = boxes[i, 2]
ty2 = boxes[i, 3]
ts = boxes[i, 4]
pos = i + 1
# get max box, 通过while循环, 找到index:i与boxes数组后面部分的最大得分的box的index和最大得分
while pos < n:
if maxscore < boxes[pos, 4]:
maxscore = boxes[pos, 4]
maxpos = pos
pos = pos + 1
# add max box as a detection,
# 把最大得分的box信息和当前指针位置的box信息互相交换
boxes[i, 0] = boxes[maxpos, 0]
boxes[i, 1] = boxes[maxpos, 1]
boxes[i, 2] = boxes[maxpos, 2]
boxes[i, 3] = boxes[maxpos, 3]
boxes[i, 4] = boxes[maxpos, 4]
# swap ith box with position of max box
boxes[maxpos, 0] = tx1
boxes[maxpos, 1] = ty1
boxes[maxpos, 2] = tx2
boxes[maxpos, 3] = ty2
boxes[maxpos, 4] = ts
pos = i + 1 # 重置pos 为i的下一个index
while pos < n:
x1 = boxes[pos, 0]
y1 = boxes[pos, 1]
x2 = boxes[pos, 2]
y2 = boxes[pos, 3]
s = boxes[pos, 4]
area = (x2 - x1 + 1) * (y2 - y1 + 1) #
iw = (min(tx2, x2) - max(tx1, x1) + 1) #
if iw > 0: # iw >0,ih>0 pos位置的box与i位置的box是相交的
ih = (min(ty2, y2) - max(ty1, y1) + 1) #
if ih > 0:
ua = float((tx2 - tx1 + 1) * (ty2 - ty1 + 1) + area - iw * ih)
#
ov = iw * ih / ua # iou between max box and detection box iou
if method == 1: # linear
if ov > Nt:
weight = 1 - ov
else:
weight = 1
elif method == 2: # gaussian 默认选择
weight = np.exp(-(ov * ov) / sigma)
else: # original NMS
if ov > Nt:
weight = 0
else:
weight = 1
# weight
# 对pos 位置的box的得分进行修改
boxes[pos, 4] = weight * boxes[pos, 4]
# if box score falls below threshold, discard the box by swapping with last box
# update n 如果box的得分经过抑制后低于设置的阈值,抛弃这个box, 使用数组中的最后一个box的信息做替换
if boxes[pos, 4] < threshold:
boxes[pos, 0] = boxes[n - 1, 0]
boxes[pos, 1] = boxes[n - 1, 1]
boxes[pos, 2] = boxes[n - 1, 2]
boxes[pos, 3] = boxes[n - 1, 3]
boxes[pos, 4] = boxes[n - 1, 4]
n = n - 1
pos = pos - 1
pos = pos + 1
keep = [i for i in range(n)]
return keep, boxes
and you need change code(cornernet_saccade.py) in the same place where function soft_nms is used. .......... top_bboxes = {} # {类别id:boxes(8个坐标的)} for j in range(categories): keep_inds = (classes == j) top_bboxes[j + 1] = detections[keep_inds][:, 0:7].astype(np.float32) # 预测的最后调用了 soft_nms # 这里需要修改, 传入的是8个坐标的boxes keep_inds, after_nms_boxes = soft_nms(top_bboxes[j + 1], Nt=nms_threshold, method=nms_algorithm, sigma=0.7) # print(keep_inds) # print(after_nms_boxes) # print(type(keep_inds)) # print("===============")
if keep_inds is not None:
one_boxes = []
for one_keep_index in keep_inds:
one_box = after_nms_boxes[one_keep_index]
one_boxes.append(one_box[0:5])
else:
one_boxes = after_nms_boxes
# top_bboxes[j + 1] = top_bboxes[j + 1][keep_inds, 0:5] # 4个坐标 + 上点和下点的平均分类得分
top_bboxes[j + 1] = np.array(one_boxes) # 4个坐标 + 上点和下点的平均分类得分
.......
Anyone solved bbox and nms-gpu in win10?
yes it solved
Anyone solved bbox and nms-gpu in win10?
yes it solved
We only tested CornerNet-Lite on Linux and we don't have a Windows machine so I am not sure if the code will run properly on Windows 10. Hello,when i python train.py,have a error. cfg_file = os.path.join(system_configs.config_dir, args.cfg_file + ".json") TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' Can you help me?thank you.