质检
【车道任务】
别人已经做好的数据,需要对其进行审核。
导入json文件,进行审核。
可能会有漏标情况,补线并保存,但 #Labels
数量不会进行更新。
【进行确认】
这里我新增了2条车道线
导出 json文件,查找 *Categories(类别)中的唯一类别属性 *category
(每新增一个线值就会加一),确定更改后的 #Labels
数量为 289(图片上#Labels
数量为287)
【结论】
Scalabel只会统计 导入的json文件 #Label数量。
【解决方法】
- 用notepad查询
*category
数量 - 重新导入更改后的json文件,查看
#Labels
数量 - 写个小程序 一劳永逸提取
*category
数量
# _*_coding:utf-8
import re
import os
path = input('请输入json所在地址:')
count = 0
img_count = 0
label_count = 0
files = os.listdir(path)
files_num = len([file for file in files if file.endswith('.json')])
for file in files:
if(file.endswith('.json')):
file_path = os.path.join(path, file)
# 统计josn文件中'category'的数量
json = open(file_path, 'r', encoding='utf-8').read()
for ch in '|"!@#$%^&*()_=+-/,:;"<>?\\`[]{|}.~':
json = json.replace(ch, " ")
words = json.split()
counts = {}
for word in words:
counts[word] = counts.get(word, 0)+1
num_img = counts['index']
try:
label_count += counts['category']
count += 1
rate = int(count * 100 / files_num)
print(f'\r当前进度:{"="*(2*rate//10)+">"}{" "*(20-2*rate//10)}{rate}%', end="")
# 没有category的情况
except KeyError:
count += 1
rate = int(count * 100 / files_num)
print(f'\r当前进度:{"="*(2*rate//10)+">"}{" "*(20-2*rate//10)}{rate}%', end="")
img_count += num_img
print(f'\n标框数量: {label_count}')
print(f'图片数量: {img_count}')