未验证 提交 12f6e9d3 编写于 作者: qq_30618961's avatar qq_30618961 提交者: GitHub

[MOT] fix pedestrian vehicle extract script (#4365)

* fix

* edit_pedestrian_vehicle_extract_script

* fix

* fix extract data script

* add description of exclusion sequence

* add description of exclusion sequence
上级 9e55e671
......@@ -23,6 +23,14 @@ import random
# The object category indicates the type of annotated object,
# (i.e., ignored regions(0), pedestrian(1), people(2), bicycle(3), car(4), van(5), truck(6), tricycle(7), awning-tricycle(8), bus(9), motor(10),others(11))
# Extract single class or multi class
isExtractMultiClass = False
# These sequences are excluded because there are too few pedestrians
exclude_seq = [
"uav0000117_02622_v", "uav0000182_00000_v", "uav0000268_05773_v",
"uav0000305_00000_v"
]
def mkdir_if_missing(d):
if not osp.exists(d):
......@@ -46,7 +54,7 @@ def genGtFile(seqPath, outPath, classes=[]):
newLine = line[0:6]
newLine[1] = str(id_idx)
newLine.append('1')
if (len(classes) > 1):
if (len(classes) > 1 and isExtractMultiClass):
class_index = str(classes.index(line[7]) + 1)
newLine.append(class_index)
else:
......@@ -98,6 +106,8 @@ def genMotLabels(datasetPath, outputFileName, classes=['2']):
annotationsList = glob.glob(osp.join(annotationsPath, '*.txt'))
for annotationPath in annotationsList:
seqName = annotationPath.split('/')[-1].replace('.txt', '')
if seqName in exclude_seq:
continue
mkdir_if_missing(osp.join(datasetPath, outputFileName, seqName, 'gt'))
mkdir_if_missing(osp.join(datasetPath, outputFileName, seqName, 'img1'))
genGtFile(annotationPath,
......@@ -249,10 +259,10 @@ def parse_arguments():
parser.add_argument("--genImageList", type=bool, default=False)
parser.add_argument("--visualImg", type=bool, default=False)
parser.add_argument("--visualGt", type=bool, default=False)
parser.add_argument("--data_name", type=str, default='visdrone_pedestrain')
parser.add_argument("--data_name", type=str, default='visdrone_pedestrian')
parser.add_argument("--phase", type=str, default='train')
parser.add_argument(
"--classes", type=str, default='1, 2') # pedestrian and people
"--classes", type=str, default='1,2') # pedestrian and people
return parser.parse_args()
......
......@@ -23,6 +23,11 @@ import random
# The object category indicates the type of annotated object,
# (i.e., ignored regions(0), pedestrian(1), people(2), bicycle(3), car(4), van(5), truck(6), tricycle(7), awning-tricycle(8), bus(9), motor(10),others(11))
# Extract single class or multi class
isExtractMultiClass = False
# The sequence is excluded because there are too few vehicles
exclude_seq = ["uav0000086_00000_v"]
def mkdir_if_missing(d):
if not osp.exists(d):
......@@ -46,7 +51,7 @@ def genGtFile(seqPath, outPath, classes=[]):
newLine = line[0:6]
newLine[1] = str(id_idx)
newLine.append('1')
if (len(classes) > 1):
if (len(classes) > 1 and isExtractMultiClass):
class_index = str(classes.index(line[7]) + 1)
newLine.append(class_index)
else:
......@@ -98,6 +103,8 @@ def genMotLabels(datasetPath, outputFileName, classes=['2']):
annotationsList = glob.glob(osp.join(annotationsPath, '*.txt'))
for annotationPath in annotationsList:
seqName = annotationPath.split('/')[-1].replace('.txt', '')
if seqName in exclude_seq:
continue
mkdir_if_missing(osp.join(datasetPath, outputFileName, seqName, 'gt'))
mkdir_if_missing(osp.join(datasetPath, outputFileName, seqName, 'img1'))
genGtFile(annotationPath,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册