Comments (2)
Download the dataset CCPD, and you could generate the dataset.json using the code snippet below:
import os
import cv2
import json
import random
import multiprocessing
provinces = ["皖", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "京", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂", "琼", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "警", "学", "O"]
alphabets = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'O']
ads = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'O']
def process(walk):
dataset = []
for root, filename in walk:
name, ext = os.path.splitext(filename)
labels = name.split("-")
if len(labels) < 7:
continue
image = os.path.join(root, filename)
height, width = cv2.imread(image, 1).shape[:2]
points = labels[3].split("_")
points = [tuple(points[2].split("&")), tuple(points[3].split("&")), tuple(points[0].split("&")), tuple(points[1].split("&"))]
points = [float(x) / width for x, _ in points] + [float(y) / height for _, y in points]
plate = [int(tk) for tk in labels[4].split("_")]
plate = "".join([provinces[plate[0]], alphabets[plate[1]]] + [ads[tk] for tk in plate[2:]])
dataset.append({"image": image, "points": points, "plate": plate})
return dataset
if __name__ == "__main__":
walk = [(root, filename) for root, _, files in os.walk("CCPD2019") for filename in files]
walk = [walk[i:i + 10000] for i in range(0, len(walk), 10000)]
with multiprocessing.Pool(multiprocessing.cpu_count() * 2) as p:
dataset = [dc for ds in p.map(process, walk) for dc in ds]
random.shuffle(dataset)
print(json.dumps(dataset))
from alpr_utils.
ok,thanks for your answer
from alpr_utils.
Related Issues (20)
- 多种类车牌识别 HOT 5
- 训练数据 HOT 8
- How can I get the dataset.json HOT 3
- 车牌检测的wpod网络可以改成并行输入吗 HOT 2
- 如何将模型转换为 JSON? HOT 1
- 请问ocr模型如何转成静态图的json模型去部署呢? HOT 2
- 请问如何将params模型转化成onnx HOT 1
- Dataset used
- 请教如何生成训练数据 HOT 2
- 您好,发现这个算法写的真的太好了,不知是否方便把怎么训练模型的过程为我们介绍学习一下下 HOT 1
- no file: fake/chinese/random_plate HOT 2
- pretrained model
- Permission error HOT 1
- 请问finetune.json文件怎么生成呢? HOT 1
- 您好,提个问题 HOT 2
- 我在请教一下 HOT 2
- where are 他和
- where are the pretrain model? HOT 1
- A docker image to help deployment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alpr_utils.