zeroe04 / r-centernet Goto Github PK
View Code? Open in Web Editor NEWdetector for rotated-object based on CenterNet/基于CenterNet的旋转目标检测
detector for rotated-object based on CenterNet/基于CenterNet的旋转目标检测
你好,感谢您的分享,请问训练时图片缩小4倍的考虑时什么呢?为了提高小目标的检测率吗?谢谢。
Hi! I am very interested in your work, Do you compare the performance of R-CenterNet in AirPlane datasets with that of orignal CenterNet?
我将骨干网络改成了resnet18,并成功生成了pt格式(如以下代码),但是在Libtorch上调用时出错了,我怀疑是不是模型的输出接口用的是列表的形式,在Libtorch中无法识别,请问有什么样的解决办法吗?
//python生成pt格式模型:
model = ResNet(18)
model.load_state_dict(torch.load("ResNet18_best.pth"))
model.to("cpu")
traced_script_module = torch.jit.trace(model,torch.ones(1,3,512,512), strict=False)
traced_script_module.save("1.pt")
//Libtorch调用代码
torch::jit::script::Module model;
model = torch::jit::load("./1.pt");
//Libtorch调用时显示的错误:
Assertion failed: idx < size(), file C:\b\windows\pytorch\c10/util/SmallVector.h, line 201
Thanks for you r code.
I have trained this model on my dataset, but when i predict the targets, the angle prediction turns to be zero.
Furthermore, the loss did not converge when epoch=100.
Please give some suggestions.
"bbox": [
506.5467,
124.2383,
62.0,
91.0,
3.3464944418634275
],
分别为目标中心点(x,y),以及宽度,长度,角度,角度是以12点钟为0°,顺时针旋转的角度
可是代码里面怎么还是和原版centernet解析x1,y1,x2,y2用的一样
for k in range(num_objs): # num_objs图中标记物数目
ann = anns[k] # 第几个标记物的标签
bbox, an = coco_box_to_bbox(ann['bbox'])
cls_id = int(self.cat_ids[ann['category_id']])
bbox[:2] = affine_transform(bbox[:2], trans_output) # 将box坐标转换到 128*128内的坐标
bbox[2:] = affine_transform(bbox[2:], trans_output)
bbox[[0, 2]] = np.clip(bbox[[0, 2]], 0, output_w - 1)
bbox[[1, 3]] = np.clip(bbox[[1, 3]], 0, output_h - 1)
# 上面几行都是做数据扩充和resize之后的变换,不重要
h, w = bbox[3] - bbox[1], bbox[2] - bbox[0]
if h > 0 and w > 0:
radius = gaussian_radius((math.ceil(h), math.ceil(w)))
radius = max(0, int(radius))
ct = np.array([(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2], dtype=np.float32)
ct_int = ct.astype(np.int32)
draw_gaussian(hm[cls_id], ct_int, radius)
wh[k] = 1. * w, 1. * h
ang[k] = 1. * an
ind[k] = ct_int[1] * output_w + ct_int[0]
reg[k] = ct - ct_int
reg_mask[k] = 1
ret = {'input': inp, 'hm': hm, 'reg_mask': reg_mask, 'ind': ind, 'wh': wh, 'ang':ang}
Why I can't find the detect head,are you fix it to backbone?
'AttributeError: 'NoneType' object has no attribute 'shape''
How to solve?
How do I choose img_size for the model? Thanks you
首先很感谢作者的贡献!
因为之前看到的角度都是利用cv2.minAreaRect得到的,范围是(-90,0),位于第一象限。
但是本算法需要的角度是labelImg2得到的,范围(0, 180),位于第一、第四象限,不知道如何转换.
有知道的小伙伴没?
ONNX export failed: Couldn't export Python operator _DCNv2
作者你好!如果将输入的数据集中的旋转角全部设置为0,loss中计算旋转角的loss,会对卷积网络和最后的模型有什么影响吗?
Thanks for your great work
In the file of predict.py, why use this equation?
x0n= (x0 -x)*cosA -(y0 - y)*sinA + x
y0n = (x0-x)*sinA + (y0 - y)*cosA + y
x1n= (x1 -x)*cosA -(y1 - y)*sinA + x
y1n = (x1-x)*sinA + (y1 - y)*cosA + y
x2n= (x2 -x)*cosA -(y2 - y)*sinA + x
y2n = (x2-x)*sinA + (y2 - y)*cosA + y
x3n= (x3 -x)*cosA -(y3 - y)*sinA + x
y3n = (x3-x)*sinA + (y3 - y)*cosA + y
角度是怎么定义的?
R-CenterNet-master/imgs/001.jpg
比如这张图,里面只有一个大飞机,对应的xml。
0.54
这里的0.54是啥,是什么和什么之间的夹角,最好用图画出来说明一下。这样才直观。
<annotation>
<folder>img</folder>
<filename>001.jpg</filename>
<path>F:\CV\毕业设计\打标签\img\001.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>958</width>
<height>808</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>aircraft</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>602.1491</cx>
<cy>523.8509</cy>
<w>93.0</w>
<h>105.0</h>
<angle>0.54</angle>
</robndbox>
<extra/>
</object>
</annotation>
Dear Author:
When I use this code to train for multiple categories, I find the code in "dataset.py" about line 37 "self._valid_ids = [1]" .Does it need to be modified? For example, two categories, self._valid_ids = [1, 2].
作者你好!我尝试使用这个工程去做行人检测,由于数据集问题,我去掉了旋转角,修改后可以正常训练模型,但是在模型评估阶段,我同样去掉了ang相关的内容,使用普通的iou。但是all_pre_num和num的输出都是0。我尝试去寻找哪里出了问题,在evalution.py文件的get_pre_ret函数中打印res = np.delete(res, 0, 0)之后得到的res=[],这是为什么呢?
我将修改之后的evalution和predict代码放在了csdn里:
https://blog.csdn.net/weixin_43786395/article/details/121322506?spm=1001.2014.3001.5501
如果您能有时间有时间浏览,将会非常感谢!!!
显存爆了,怀疑是batch_size太大,找不到改的地方。每次都是训练到第一个epoch第6个iter就断了
我用的piou+centerOBB, trace成功了模型 但是模型不对,看网上有人说应该用script 但script只支持python的子集 需要修改forward的代码,修改到DLAUp的getAttr(self, "proj_" + str(startp - i)) 这种代码就修改不下去了,因为script不支持动态函数,请教大神们有成功把centernet这一类的模型给成功script的吗 (不是用trace的哈),可否参考一下script修改的forward源码 谢谢!
trans_input = get_affine_transform(c, s, 0, [input_w, input_h])
训练测试都是这么用的,仿射变换后的的图片向右上角偏,左下角全黑?
ImportError: cannot import name 'deform_conv_cuda'
使用不同backbone的情况下,在多种实验下表明,只有dla34_dcn的backbone的angle_loss可以收敛,其他backbone包括resdcn_50,101,以及dlav0_34,angle_loss均无法有效收敛,其他head的loss表现均不错,这个问题可能是什么?角度的量纲?感受野?还是?
The angle of my dataset is 0-180 or -90 to 90 ? thanks you
大佬您好,我训练HRSC2016数据集最终train loss和val loss维持在4左右就不变了,测试了demo发现预测效果也不好。能指点一二吗?谢谢了
非常感谢!!!感觉这是我见过说的最详细的一个啦!:"D
There are more cases of missed targets. Which parameters should I modify to improve the effect?
Dear @ZeroE04 ,
Thank you for sharing your work.
I am not clear about the bbox annotation of your dataset. I guess it is in xc, yc, w, h, ang
, but I do not know how w, h
are measured, parallel to the image coordinates or from the cv2.minAreaRect
?
Line 221 in 828184b
For my dataset
rect = cv2.minAreaRect(hull)
xc, yc = rect[0][0], rect[0][1]
w, h = rect[1][0], rect[1][1]
angle = rect[2]
angle = ange_to_0_180(angle)
rbbox = [xc, yc, w, h, angle]
So, with my bbox annotation, I do not have to use the coco_box_to_bbox
function right?
Thank for your time.
win10,显卡2080s,train.py训练正常,训练完成后运行predict出现错误。
Traceback (most recent call last):
File "D:/R-CenterNet-master/predict.py", line 237, in
output, dets, forward_time = process(images, return_time=True)
File "D:/R-CenterNet-master/predict.py", line 152, in process
output = model(images)
File "D:\Anaconda\envs\CenterNet2\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "./backbone\dlanet.py", line 610, in forward
ret[head] = self.getattr(head)(x)
File "D:\Anaconda\envs\CenterNet2\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\Anaconda\envs\CenterNet2\lib\site-packages\torch\nn\modules\container.py", line 91, in forward
input = module(input)
File "D:\Anaconda\envs\CenterNet2\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "D:\Anaconda\envs\CenterNet2\lib\site-packages\torch\nn\modules\conv.py", line 301, in forward
self.padding, self.dilation, self.groups)
RuntimeError: CUDA error: out of memory
求问
请问 多类别训练,除了更改num_classes变量,还需要更改其他的吗?
当种类训练,最终验证在evolations.py中怎么修改得到map的值
最好是resNet的,其他的也行,😊😊
Why this project does not need to provide the variance and standard deviation of the datasets like orign CenterNet
是以长边为准,还是如何呢?仅以上边中心点,下边中心点连线的斜率,感觉定义不是很准啊!
你好,请问wh是如何确定的?我现在知道4点坐标,但是无法确定你所说的wh,angle我可以计算,只要确定了wh
报错为:
Traceback (most recent call last): File "train.py", line 13, in <module> from visualize import Visualizer ModuleNotFoundError: No module named 'visualize'
在dota数据上效果怎么样?
有人知道怎么根据给定的矩形的四个顶点坐标来生成符合要求的json文件吗?都需要什么变量啊?求分享代码
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.