-
Notifications
You must be signed in to change notification settings - Fork 118
load_hrsc loads all objects as ship, arguments classes is no use #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
现阶段HRSC2016数据集只是作为船只检测的数据集,舰船的型号是不会做区分的。大多数有向目标检测的论文也是这样处理的。 |
嗯嗯 好的 |
请问如果我需要检测并验证其它的类别,不仅仅是ship类,我应该怎么更改参数呢?我尝试更改BboxToolkit/BboxToolkit/datasets/misc.py中的dataset_classes类别,将'HRSC': ('ship', ),更改为'HRSC': ('submarine','merchant ship','ship', ),但是好像并没起作用。请问其它还有地方需要更改吗?比如类别数目等? |
还有 hrscio.py 里面加载标签的部分需要修改: def _load_hrsc_xml(xmlfile, img_keys=dict(), obj_keys=dict()):
hbboxes, bboxes, diffs, class_id = list(), list(), list(), list()
content = {k: None for k in img_keys}
ann = {k: [] for k in obj_keys}
if xmlfile is None:
pass
elif not osp.isfile(xmlfile):
print(f"Can't find {xmlfile}, treated as empty xmlfile")
else:
tree = ET.parse(xmlfile)
root = tree.getroot()
content['width'] = int(root.find('Img_SizeWidth').text)
content['height'] = int(root.find('Img_SizeHeight').text)
for k, xml_k in img_keys.items():
node = root.find(xml_k)
value = None if node is None else node.text
content[k] = value
objects = root.find('HRSC_Objects')
for obj in objects.findall('HRSC_Object'):
hbboxes.append([
float(obj.find('box_xmin').text),
float(obj.find('box_ymin').text),
float(obj.find('box_xmax').text),
float(obj.find('box_ymax').text)
])
bboxes.append([
float(obj.find('mbox_cx').text),
float(obj.find('mbox_cy').text),
float(obj.find('mbox_w').text),
float(obj.find('mbox_h').text),
-float(obj.find('mbox_ang').text)
])
diffs.append(int(obj.find('difficult').text))
class_id.append(int(obj.find('Class_ID').text[2:])-1)
for k, xml_k in obj_keys.items():
node = obj.find(xml_k)
value = None if node is None else node.text
ann[k].append(value)
hbboxes = np.array(hbboxes, dtype=np.float32) if hbboxes \
else np.zeros((0, 4), dtype=np.float32)
bboxes = np.array(bboxes, dtype=np.float32) if bboxes \
else np.zeros((0, 5), dtype=np.float32)
diffs = np.array(diffs, dtype=np.int64) if diffs \
else np.zeros((0,), dtype=np.int64)
labels = np.array(class_id, dtype=np.int64) if class_id \
else np.zeros((0,), dtype=np.int64)
# labels = np.zeros((bboxes.shape[0],), dtype=np.int64)
ann['hbboxes'] = hbboxes
ann['bboxes'] = bboxes
ann['diffs'] = diffs
ann['labels'] = labels
content['ann'] = ann
return content |
可以先对照上面的答复进行修改,之后我将对HRSCio进行修改 |
请问对hrsc数据集的处理是把所有的类别都当作ship类吗?都打上label = 0?如果我只想训练数据集的某几个类呢?这个HRSCio我其实没太看懂怎么处理的。谢谢 |
你似乎连我贴出来的代码都没有读完?! |
不好意思,你的代码已经正在尝试了,再等待训练结果出来。 |
加载hrsc数据集,所有的图片的类名都是 ”ship“,这个怎么弄啊?
The text was updated successfully, but these errors were encountered: