未验证 提交 2813b714 编写于 作者: K Kaipeng Deng 提交者: GitHub

raise error for class_num mismatch (#2354)

* add warning for class_num mismatch

* change to value error
上级 5c8d654e
...@@ -73,6 +73,11 @@ class DataSetReader(object): ...@@ -73,6 +73,11 @@ class DataSetReader(object):
self.label_ids.append(int(category['id'])) self.label_ids.append(int(category['id']))
self.category_to_id_map = {v: i for i, v in enumerate(self.label_ids)} self.category_to_id_map = {v: i for i, v in enumerate(self.label_ids)}
print("Load in {} categories.".format(self.num_category)) print("Load in {} categories.".format(self.num_category))
if self.num_category != cfg.class_num:
raise ValueError("category number({}) in your dataset is not equal "
"to --class_num={} settting, which may incur errors in "
"eval/infer or cause precision loss.".format(
self.num_category, cfg.class_num))
self.has_parsed_categpry = True self.has_parsed_categpry = True
def get_label_infos(self): def get_label_infos(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册