opencv_zoo icon indicating copy to clipboard operation
opencv_zoo copied to clipboard

Text Detection: add ppocr-v2 detect -WIP

Open the-star-sea opened this issue 2 years ago • 21 comments

  • [x] add demo
  • [x] add example in readme

the-star-sea avatar Jun 29 '22 03:06 the-star-sea

Hi @the-star-sea. Since in OpenCV the DB has been supported by High-Level API, can you provide more speed and accuracy test data for DB and proposed ppocr?

zihaomu avatar Jul 20 '22 05:07 zihaomu

Hi @the-star-sea. Since in OpenCV the DB has been supported by High-Level API, can you provide more speed and accuracy test data for DB and proposed ppocr?

ok.I will do it

the-star-sea avatar Jul 20 '22 07:07 the-star-sea

image.png

the-star-sea avatar Jul 24 '22 03:07 the-star-sea

@the-star-sea the ppocr's speed is super fast. two questions:

  1. Are the pre-process and the post-process of ppocr's the same as the DB net?
  2. Is there accuracy test result?

zihaomu avatar Jul 25 '22 03:07 zihaomu

@the-star-sea the ppocr's speed is super fast. two questions:

  1. Are the pre-process and the post-process of ppocr's the same as the DB net?
  2. Is there accuracy test result?

1.almost the same 2. image.png image.png

the-star-sea avatar Jul 25 '22 04:07 the-star-sea

Thank you @the-star-sea! The accuracy result is good. Which validation data are used? How many data it has?

zihaomu avatar Jul 25 '22 05:07 zihaomu

icdar2015.500 imgs.

the-star-sea avatar Jul 25 '22 05:07 the-star-sea

Thanks for the clarification. The DB model has hidded the post-process in the high level api, some thing like the following:


model = cv.dnn_TextDetectionModel_DB(
            cv.dnn.readNet(self._modelPath)
        )

# time start
model.detect(image)
# time stop

In order to get a fair speed comparison result, how did you test the speed of ppocr?

zihaomu avatar Jul 25 '22 05:07 zihaomu

I write the config file in benchmark and add function support in ppdetect.It just tests the speed of infering onnx model. Besides.the onnx filesize of ppdetect is 2284 while DB is 47628.

the-star-sea avatar Jul 25 '22 07:07 the-star-sea

47628

That's a great answer. Thanks! Can we re-use the High-Level API of DB for PPocr with no change or little change?

model = cv.dnn_TextDetectionModel_DB(
            cv.dnn.readNet(modelPath_ppocr)
        )
model.detect(image)

zihaomu avatar Jul 25 '22 08:07 zihaomu

I think there need some changes because ppocr doesnot need polygon threhold.I will do it.

the-star-sea avatar Jul 26 '22 08:07 the-star-sea

@the-star-sea Please keep one in the mobile and normal models, as we discussed before, to avoid confusing users.

zihaomu avatar Aug 30 '22 02:08 zihaomu

@the-star-sea Please keep one in the mobile and normal models, as we discussed before, to avoid confusing users.

ok.I will do it

the-star-sea avatar Aug 31 '22 06:08 the-star-sea

I suggest we remove DB from opencv_zoo after this pull request is merged.

Hi @fengyuentau, how about leaving it to the next PR to remove DB model, because we have a lot of speed tests based on the DB model. In addition, the high-level API based ppocr model has not been completed and is expected to be completed by the end of September.

zihaomu avatar Sep 05 '22 07:09 zihaomu

Sure, thats exactly what I meant. Just want to emphasize this plan.

fengyuentau avatar Sep 06 '22 03:09 fengyuentau

@zihaomu Please update benchmark results on this model.

fengyuentau avatar Sep 08 '22 01:09 fengyuentau

@zihaomu Please update benchmark results on this model.

Hi, @fengyuentau the benchmark results will be updated at PR #73, the student will complete it in the near future.

zihaomu avatar Sep 08 '22 02:09 zihaomu

When we add or update a model in opencv zoo, we always update the average forward latency in the same pull request.

fengyuentau avatar Sep 08 '22 02:09 fengyuentau

Ok, let's wait.

zihaomu avatar Sep 08 '22 02:09 zihaomu

We dont need to wait for #73 as it is for accuracy. At least we need the speed of this model to merge a pull request of adding or updating a model.

fengyuentau avatar Sep 08 '22 02:09 fengyuentau

After this PR is merged, PP-OCR_v3 can be supported and loaded with high-level API. And I think we can only put PP-OCR_v3 in opencv_zoo since it has better accuracy.

zihaomu avatar Oct 13 '22 00:10 zihaomu

@zihaomu Anything else is blocking this PR from merge?

Update: we need to merge with benchmark results. Could you run benchmarking with this model? @zihaomu

fengyuentau avatar Oct 21 '22 07:10 fengyuentau

@zihaomu Anything else is blocking this PR from merge?

Update: we need to merge with benchmark results. Could you run benchmarking with this model? @zihaomu

This PR should be closed after the OpenCV support new DB API, since new DB API support pp-ocr V3 and V2.

zihaomu avatar Oct 21 '22 07:10 zihaomu

This PR should be closed

Didn't we agree on adding this model (pp-ocr) in place of db? Why are we closing this PR?

fengyuentau avatar Oct 22 '22 02:10 fengyuentau

We can directly support ppocr-DB v2 and v3 at new API.

zihaomu avatar Oct 25 '22 07:10 zihaomu