提交 47be3dcf 编写于 作者: M Martijn Buijs 提交者: Kentaro Wada

Allow loading labels from file

上级 d29670eb
......@@ -1130,13 +1130,18 @@ def main():
parser.add_argument('--output', '-O', '-o', help='output label name')
parser.add_argument('--nodata', dest='store_data', action='store_false',
help='stop storing image data to JSON file')
parser.add_argument('--labels', help='comma separated list of labels')
parser.add_argument('--labels', help='comma separated list of labels OR file containing one label per line')
parser.add_argument('--nosortlabels', dest='sort_labels',
action='store_false', help='stop sorting labels')
args = parser.parse_args()
if args.labels is not None:
args.labels = [l for l in args.labels.split(',') if len(l) > 0]
if os.path.isfile(args.labels):
args.labels = [l.strip()
for l in open(args.labels, 'r').readlines()
if len(l.strip()) > 0]
else:
args.labels = [l for l in args.labels.split(',') if len(l) > 0]
app = QApplication(sys.argv)
app.setApplicationName(__appname__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册