PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

Transfer Learning with Paddle?

Open mazatov opened this issue 3 years ago • 3 comments

Is there a way to do transfer learning with Paddle? I have a smallish dataset ( ~1000-10000 images) with only 10-15 possible answers. I'd like to do a version of transfer learning on PP-OCRv3 so it learns that only one of these 10-15 answers is possible.

Is there a way to freeze part of the network to do that?

mazatov avatar Oct 13 '22 13:10 mazatov

Or maybe freeze layers of the backbone at least somehow?

mazatov avatar Oct 14 '22 07:10 mazatov

currently paddleocr does not support freezing backbone, but you can fix the code mannually, such as here.

https://github.com/PaddlePaddle/PaddleOCR/blob/558b2a719efc8761539649ed676ff405401a90a7/ppocr/modeling/architectures/distillation_model.py#L50

littletomatodonkey avatar Oct 14 '22 13:10 littletomatodonkey

@littletomatodonkey , thanks for the tip. In my case I'm thinking to do transfer learning on PP-OCRV3. So I'm thinking to freeze the backbone of PP-OCRv3, MobileNetV1Enhance.

Would something like this here the net?

        for param in self.conv1.parameters():
            param.trainable = False
        for param in self.block_list.parameters():
            param.trainable = False    

mazatov avatar Oct 15 '22 12:10 mazatov

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 08 '23 02:07 github-actions[bot]