diff --git a/doc/doc_ch/detection.md b/doc/doc_ch/detection.md index cfff12f976f0a0abe06c37187755d78358e5ca25..850f67ca8ac0a476136e80d2e7413b328743c548 100644 --- a/doc/doc_ch/detection.md +++ b/doc/doc_ch/detection.md @@ -26,7 +26,7 @@ wget -P ./train_data/ https://paddleocr.bj.bcebos.com/dataset/test_icdar2015_la 提供的标注文件格式为,其中中间是"\t"分隔: ``` " 图像文件名 json.dumps编码的图像标注信息" -ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]], ...}] +ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}] ``` json.dumps编码前的图像标注信息是包含多个字典的list,字典中的 `points` 表示文本框的四个点的坐标(x, y),从左上角的点开始顺时针排列。 `transcription` 表示当前文本框的文字,在文本检测任务中并不需要这个信息。 diff --git a/doc/doc_ch/installation.md b/doc/doc_ch/installation.md index 8d7b659eb3c71df38f57b01e8510680ae135e35f..360e0cb6179f99c2e938899445c30df0a3e0797b 100644 --- a/doc/doc_ch/installation.md +++ b/doc/doc_ch/installation.md @@ -21,10 +21,10 @@ cd /home/Projects 如果您希望在CPU环境下使用docker,使用docker而不是nvidia-docker创建docker sudo docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash -如果您的机器安装的是CUDA9,请运行以下命令创建容器 +如果使用CUDA9,请运行以下命令创建容器 sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash -如果您的机器安装的是CUDA10,请运行以下命令创建容器 +如果使用CUDA10,请运行以下命令创建容器 sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.0-cudnn7-dev /bin/bash 您也可以访问[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/)获取与您机器适配的镜像。 diff --git a/doc/doc_en/detection_en.md b/doc/doc_en/detection_en.md index 280c4bf8b8b4e08da32c719dc8ceba6eb8391f26..f22c574b9413cc703f5802edb1a2837d5fad7ef8 100644 --- a/doc/doc_en/detection_en.md +++ b/doc/doc_en/detection_en.md @@ -25,7 +25,7 @@ After decompressing the data set and downloading the annotation file, PaddleOCR/ The provided annotation file format is as follow, seperated by "\t": ``` " Image file name Image annotation information encoded by json.dumps" -ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]], ...}] +ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}] ``` The image annotation after json.dumps() encoding is a list containing multiple dictionaries. The `points` in the dictionary represent the coordinates (x, y) of the four points of the text box, arranged clockwise from the point at the upper left corner. diff --git a/doc/doc_en/installation_en.md b/doc/doc_en/installation_en.md index 94aacd6d24ff0a2cab12d1820a110ef95f8c4e8b..c8902ac08cbc5f0f48e369fb8f0e3afc41aa42aa 100644 --- a/doc/doc_en/installation_en.md +++ b/doc/doc_en/installation_en.md @@ -18,14 +18,14 @@ cd /home/Projects # You need to create a docker container for the first run, and do not need to run the current command when you run it again # Create a docker container named ppocr and map the current directory to the /paddle directory of the container -#If you want to use docker in a CPU environment, use docker instead of nvidia-docker to create docker +#If using CPU, use docker instead of nvidia-docker to create docker sudo docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash ``` -If you have cuda9 installed on your machine, please run the following command to create a container: +If using CUDA9, please run the following command to create a container: ``` sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda9.0-cudnn7-dev /bin/bash ``` -If you have cuda10 installed on your machine, please run the following command to create a container: +If using CUDA10, please run the following command to create a container: ``` sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.0-cudnn7-dev /bin/bash ``` diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 578401fb37b64dbf248460acb2b4c671e6a6724c..b51c49fcb90657d766bddb3c39b4339e6a342a2f 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -122,9 +122,9 @@ class TextRecognizer(object): ind = np.argmax(probs, axis=1) blank = probs.shape[1] valid_ind = np.where(ind != (blank - 1))[0] - score = np.mean(probs[valid_ind, ind[valid_ind]]) if len(valid_ind) == 0: continue + score = np.mean(probs[valid_ind, ind[valid_ind]]) # rec_res.append([preds_text, score]) rec_res[indices[beg_img_no + rno]] = [preds_text, score] else: diff --git a/tools/infer/utility.py b/tools/infer/utility.py index bab211a8dfa396b1aa8996cf7105452316441ed1..fc91880e2fdd39cb05d5115f5c3c76fd766b714c 100755 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -95,7 +95,7 @@ def create_predictor(args, mode): config.set_cpu_math_library_num_threads(6) if args.enable_mkldnn: config.enable_mkldnn() - + #config.enable_memory_optim() config.disable_glog_info() @@ -169,7 +169,7 @@ def draw_ocr_box_txt(image, boxes, txts): img_right = Image.new('RGB', (w, h), (255, 255, 255)) import random - # 每次使用相同的随机种子 ,可以保证两次颜色一致 + random.seed(0) draw_left = ImageDraw.Draw(img_left) draw_right = ImageDraw.Draw(img_right)