Skip to content

Commit

Permalink
This is a combination of 59 commits from v2.7.0 to v2.7.1 in (#11831)
Browse files Browse the repository at this point in the history
release/2.7.1 branch

Co-authored-by: ToddBear <[email protected]>
  • Loading branch information
jzhang533 and ToddBear authored Mar 29, 2024
1 parent ddaa85d commit 0b91f4d
Show file tree
Hide file tree
Showing 77 changed files with 4,119 additions and 583 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/newfeature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: New Feature Issue template
about: Issue template for new features.
title: ''
labels: 'Code PR is needed'
assignees: 'shiyutang'

---

## 背景

经过需求征集https://github.com/PaddlePaddle/PaddleOCR/issues/10334 和每周技术研讨会 https://github.com/PaddlePaddle/PaddleOCR/issues/10223 讨论,我们确定了XXXX任务。

## 解决步骤
1. 根据开源代码进行网络结构、评估指标转换。代码链接:XXXX
2. 结合[论文复现指南](https://github.com/PaddlePaddle/models/blob/release%2F2.2/tutorials/article-implementation/ArticleReproduction_CV.md),进行前反向对齐等操作,达到论文Table.1中的指标。
3. 参考[PR提交规范](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_ch/code_and_doc.md)提交代码PR到ppocr中。
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]

81 changes: 38 additions & 43 deletions PPOCRLabel/gen_ocr_train_val_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,43 @@ def isCreateOrDeleteFolder(path, flag):
return flagAbsPath


def splitTrainVal(root, absTrainRootPath, absValRootPath, absTestRootPath, trainTxt, valTxt, testTxt, flag):
# 按照指定的比例划分训练集、验证集、测试集
dataAbsPath = os.path.abspath(root)

if flag == "det":
labelFilePath = os.path.join(dataAbsPath, args.detLabelFileName)
elif flag == "rec":
labelFilePath = os.path.join(dataAbsPath, args.recLabelFileName)

labelFileRead = open(labelFilePath, "r", encoding="UTF-8")
labelFileContent = labelFileRead.readlines()
random.shuffle(labelFileContent)
labelRecordLen = len(labelFileContent)

for index, labelRecordInfo in enumerate(labelFileContent):
imageRelativePath = labelRecordInfo.split('\t')[0]
imageLabel = labelRecordInfo.split('\t')[1]
imageName = os.path.basename(imageRelativePath)

if flag == "det":
imagePath = os.path.join(dataAbsPath, imageName)
elif flag == "rec":
imagePath = os.path.join(dataAbsPath, "{}\\{}".format(args.recImageDirName, imageName))

# 按预设的比例划分训练集、验证集、测试集
trainValTestRatio = args.trainValTestRatio.split(":")
trainRatio = eval(trainValTestRatio[0]) / 10
valRatio = trainRatio + eval(trainValTestRatio[1]) / 10
curRatio = index / labelRecordLen

if curRatio < trainRatio:
imageCopyPath = os.path.join(absTrainRootPath, imageName)
shutil.copy(imagePath, imageCopyPath)
trainTxt.write("{}\t{}".format(imageCopyPath, imageLabel))
elif curRatio >= trainRatio and curRatio < valRatio:
imageCopyPath = os.path.join(absValRootPath, imageName)
shutil.copy(imagePath, imageCopyPath)
valTxt.write("{}\t{}".format(imageCopyPath, imageLabel))
else:
imageCopyPath = os.path.join(absTestRootPath, imageName)
shutil.copy(imagePath, imageCopyPath)
testTxt.write("{}\t{}".format(imageCopyPath, imageLabel))
def splitTrainVal(root, abs_train_root_path, abs_val_root_path, abs_test_root_path, train_txt, val_txt, test_txt, flag):

data_abs_path = os.path.abspath(root)
label_file_name = args.detLabelFileName if flag == "det" else args.recLabelFileName
label_file_path = os.path.join(data_abs_path, label_file_name)

with open(label_file_path, "r", encoding="UTF-8") as label_file:
label_file_content = label_file.readlines()
random.shuffle(label_file_content)
label_record_len = len(label_file_content)

for index, label_record_info in enumerate(label_file_content):
image_relative_path, image_label = label_record_info.split('\t')
image_name = os.path.basename(image_relative_path)

if flag == "det":
image_path = os.path.join(data_abs_path, image_name)
elif flag == "rec":
image_path = os.path.join(data_abs_path, args.recImageDirName, image_name)

train_val_test_ratio = args.trainValTestRatio.split(":")
train_ratio = eval(train_val_test_ratio[0]) / 10
val_ratio = train_ratio + eval(train_val_test_ratio[1]) / 10
cur_ratio = index / label_record_len

if cur_ratio < train_ratio:
image_copy_path = os.path.join(abs_train_root_path, image_name)
shutil.copy(image_path, image_copy_path)
train_txt.write("{}\t{}\n".format(image_copy_path, image_label))
elif cur_ratio >= train_ratio and cur_ratio < val_ratio:
image_copy_path = os.path.join(abs_val_root_path, image_name)
shutil.copy(image_path, image_copy_path)
val_txt.write("{}\t{}\n".format(image_copy_path, image_label))
else:
image_copy_path = os.path.join(abs_test_root_path, image_name)
shutil.copy(image_path, image_copy_path)
test_txt.write("{}\t{}\n".format(image_copy_path, image_label))


# 删掉存在的文件
Expand Down Expand Up @@ -148,4 +143,4 @@ def genDetRecTrainVal(args):
help="the name of the folder where the cropped recognition dataset is located"
)
args = parser.parse_args()
genDetRecTrainVal(args)
genDetRecTrainVal(args)
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ PaddleOCR旨在打造一套丰富、领先、且实用的OCR工具库,助力

<a name="技术交流合作"></a>
## 📖 技术交流合作

- 飞桨低代码开发工具(PaddleX)—— 面向国内外主流AI硬件的飞桨精选模型一站式开发工具。包含如下核心优势:
- 【产业高精度模型库】:覆盖10个主流AI任务 40+精选模型,丰富齐全。
- 【特色模型产线】:提供融合大小模型的特色模型产线,精度更高,效果更好。
- 【低代码开发模式】:图形化界面支持统一开发范式,便捷高效。
- 【私有化部署多硬件支持】:适配国内外主流AI硬件,支持本地纯离线使用,满足企业安全保密需要。
- 飞桨AI套件([PaddleX](http://10.136.157.23:8080/paddle/paddleX))提供了飞桨模型训压推一站式全流程高效率开发平台,其使命是助力AI技术快速落地,愿景是使人人成为AI Developer!
- PaddleX 目前覆盖图像分类、目标检测、图像分割、3D、OCR和时序预测等领域方向,已内置了36种基础单模型,例如RT-DETR、PP-YOLOE、PP-HGNet、PP-LCNet、PP-LiteSeg等;集成了12种实用的产业方案,例如PP-OCRv4、PP-ChatOCR、PP-ShiTu、PP-TS、车载路面垃圾检测、野生动物违禁制品识别等。
- PaddleX 提供了“工具箱”和“开发者”两种AI开发模式。工具箱模式可以无代码调优关键超参,开发者模式可以低代码进行单模型训压推和多模型串联推理,同时支持云端和本地端。
- PaddleX 还支持联创开发,利润分成!目前 PaddleX 正在快速迭代,欢迎广大的个人开发者和企业开发者参与进来,共创繁荣的 AI 技术生态!

- PaddleX官网地址:https://aistudio.baidu.com/intro/paddlex

Expand Down
Loading

0 comments on commit 0b91f4d

Please sign in to comment.