数据集:
一、
1、advancedeast
(166条消息) EAST&Advanced East算法学习_鲸落于北的博客-CSDN博客
预测逻辑:
loss:
2、关键点识别,矫正,再crnnGitHub - deepcam-cn/yolov5-face: YOLO5Face: Why Reinventing a Face Detector (https://arxiv.org/abs/2105.12931) ECCV Workshops 2022)
二、crnn
(166条消息) CRNN文字识别_GoAI的博客-CSDN博客_crnn
预测逻辑:
loss:(166条消息) 车牌字符识别中ctc loss损失函数理解_huangyiping_dream的博客-CSDN博客_ctc loss
github:
easyocr:
parseqocr
三.车牌
车牌检测识别:
数据集:CRPD CRPD2019 自标数据
GitHub - we0091234/yolov7_plate: yolov7 车牌检测 车牌识别 中文车牌识别 检测 支持双层车牌 支持12种中文车牌
[深度学习] CCPD车牌数据集介绍_ccpd数据集_落痕的寒假的博客-CSDN博客
https://github.com/we0091234/crnn_plate_recognition
不需要分层的双层车牌识别新方案_双层车牌 不分割 识别-CSDN博客
代码
伪造车牌代码: 达到95%
import os
from albumentations import Compose, OneOf, SomeOf
#dropout
from albumentations import (CoarseDropout, GridDropout)
#blur
from albumentations import (MotionBlur, GaussianBlur, GlassBlur, AdvancedBlur, MedianBlur, Defocus, ZoomBlur, Blur)
#geometric
from albumentations import (ShiftScaleRotate, Perspective, Affine, PiecewiseAffine, OpticalDistortion, GridDistortion)
#domain_adaptation
from albumentations import (HistogramMatching, FDA, PixelDistributionAdaptation)
#base
# A.RandomSunFlare(p=1.0, src_radius=170, src_color=(230, 230, 230))
from albumentations import (RandomGamma, RGBShift, GaussNoise, CLAHE,ColorJitter,
ToSepia, ImageCompression, RandomBrightnessContrast, RandomSnow, RandomRain, RandomFog, RandomSunFlare,
RandomShadow, RandomToneCurve, Lambda, ISONoise, Equalize, Posterize, Downscale, MultiplicativeNoise, FancyPCA, Sharpen,
Emboss, Superpixels, RingingOvershoot, UnsharpMask, PixelDropout, Spatter)
import cv2
# import random
# import time
# from matplotlib import pyplot as plt
# def visualize(image):
# plt.figure(figsize=(10, 10))
# plt.axis('off')
# plt.imshow(image)
# plt.show()
base_path = '/training/face-group/innersource/PLATE/recognition/'
reference_images_path = 'carprofile_qa_20210930_ocr_labels.txt'
with open(os.path.join(base_path, reference_images_path),'r') as fio:
lines = fio.readlines()
reference_image_files = [os.path.join(base_path, line.split(';')[0]) for line in lines]
aug_compose01 = Compose(
[
#Cutout相关操作
# OneOf([
# CoarseDropout(),
# ], p=0.05),
OneOf([
MotionBlur(p=0.2),
GaussianBlur(p=0.2),
GlassBlur(p=0.2),
MedianBlur(blur_limit=3, p=0.2),
Defocus(p=0.2),
Blur(blur_limit=3, p=0.1),
], p=0.3),
ColorJitter(p=0.05),
OneOf(
[
ShiftScaleRotate(shift_limit=0.0325, scale_limit=0.06, rotate_limit=4, p=0.2, border_mode= cv2.BORDER_CONSTANT),
Affine(scale=(0.94, 1.06), translate_percent=(-0.06, 0.06), rotate=(-4, 4), p=0.2),
], p=0.2),
OneOf([
# 畸变相关操作
OpticalDistortion(p=0.33, border_mode=cv2.BORDER_CONSTANT),
GridDistortion(p=0.33, border_mode=cv2.BORDER_CONSTANT),
PiecewiseAffine(p=0.3, scale=(0.01, 0.03)),
Perspective(),
], p=0.3),
# 锐化、浮雕等操作
OneOf([
CLAHE(clip_limit=2),
Sharpen(),
Emboss(),
RandomBrightnessContrast(),
], p=0.4),
OneOf(
[RandomSnow(), RandomRain(), RandomFog(),
Superpixels(),
RingingOvershoot(),
# RandomSunFlare(src_radius=170, src_color=(250, 250, 250)),
Posterize(),
ToSepia(),
RandomToneCurve()], p = 0.4
),
OneOf([
RandomGamma(), RGBShift(), GaussNoise(),
ImageCompression(),
RandomShadow(), ISONoise(), Equalize(),
Downscale(interpolation=Downscale.Interpolation(downscale=cv2.INTER_NEAREST, upscale=cv2.INTER_NEAREST)),
MultiplicativeNoise(), FancyPCA(),
UnsharpMask(), PixelDropout(drop_value=[150, 150, 150] ), Spatter()
], p=0.4)
]
)
aug_compose02 = Compose(
[
#Cutout相关操作
# OneOf([
# CoarseDropout(p=0.33),
# ], p=0.05),
OneOf([
HistogramMatching(reference_images=reference_image_files, p=0.33),
FDA(reference_images=reference_image_files, p=0.33, beta_limit=0.5),
PixelDistributionAdaptation(reference_images=reference_image_files, p=0.33),
], p=0.5),
OneOf([
MotionBlur(p=0.2, blur_limit=(10, 21)),
GaussianBlur(p=0.2),
GlassBlur(p=0.2, iterations=2, max_delta=1),
MedianBlur(blur_limit=3, p=0.2),
Defocus(p=0.2),
ZoomBlur(p=0.2, max_factor=1.2),
Blur(blur_limit=3, p=0.1),
], p=0.5),
OneOf(
[
ShiftScaleRotate(shift_limit=0.0325, scale_limit=0.1, rotate_limit=4, p=0.2, border_mode= cv2.BORDER_CONSTANT),
Affine(scale=(0.95, 1.05), translate_percent=(-0.06, 0.06), rotate=(-4, 4), p=0.2),
], p=0.2),
OneOf([
# 畸变相关操作
OpticalDistortion(p=0.33, border_mode=cv2.BORDER_CONSTANT),
GridDistortion(p=0.33, border_mode=cv2.BORDER_CONSTANT),
PiecewiseAffine(p=0.33, scale=(0.01, 0.03)),
Perspective(),
], p=0.4),
# # 锐化、浮雕等操作
OneOf([
CLAHE(clip_limit=2, p=0.25),
Sharpen(p=0.25),
Emboss(p=0.25),
RandomBrightnessContrast(p=0.25),
], p=0.3),
OneOf(
[RandomSnow(), RandomRain(), RandomFog(),
Superpixels(),
RingingOvershoot(),
# RandomSunFlare(src_radius=170, src_color=(250, 250, 250)),
Posterize(),
ToSepia(),
RandomToneCurve()], p = 0.5
),
OneOf([
RandomGamma(), RGBShift(), GaussNoise(),
ImageCompression(),
RandomShadow(), ISONoise(), Equalize(),
Downscale(interpolation=Downscale.Interpolation(downscale=cv2.INTER_NEAREST, upscale=cv2.INTER_NEAREST)),
MultiplicativeNoise(), FancyPCA(),
UnsharpMask(), PixelDropout(drop_value=[150, 150, 150] ), Spatter()
], p=0.5)
], p=1.0
)
# base_dir = '/training/face-group/innersource/PLATE/recognition/'
# image = cv2.imread(base_dir + 'syn_double_line/PTruck_云C7S338.jpg')
# image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# # visualize(image)
# aug_image = aug_compose01(image=image)['image']
# visualize(aug_image)
车牌识别为什么直接使用CNN就可以,没有用RNN
车牌识别任务中,如果车牌上的字符排列是固定的、有序的,并且字符的数量是固定的,那么可以考虑直接使用CNN(卷积神经网络)进行识别,而不需要引入RNN(循环神经网络)。
CNN在图像识别任务中表现出色,它能够有效地学习图像中的局部特征,并通过层层卷积和池化操作提取更高层次的抽象特征。对于固定排列的字符,CNN可以在整个图像中学习到字符的空间位置和形状信息。
在一些简单的车牌识别场景中,直接使用CNN可能已经足够,而不必引入RNN。例如,对于固定格式的车牌号,比如中国的蓝牌,车牌上的字符排列是有规律的,字符的数量也是固定的。这种情况下,CNN可以很好地捕捉到字符的空间关系。
然而,当车牌上的字符数量不固定、字符排列无规律,或者需要处理不定长序列时,RNN的引入就变得更为重要。RNN能够处理序列数据,对于不同长度的车牌号码更具鲁棒性。在这种情况下,通常使用的是CRNN(卷积循环神经网络)结构,其中卷积层用于提取空间特征,而循环层则用于处理序列信息。
总的来说,是否使用RNN取决于任务的复杂性和特点。对于一些简单的车牌识别问题,直接使用CNN可能已经足够,但对于更复杂的情况,引入RNN等序列模型有助于提高系统的性能。
6.