WarBean / tps_stn_pytorch

PyTorch implementation of Spatial Transformer Network (STN) with Thin Plate Spline (TPS)
926 stars 155 forks source link

How to achieve automatically rectify distorted text images,just like the result showed in the picture #2

Closed Lesley96-11 closed 6 years ago

Lesley96-11 commented 6 years ago

Actually I don't understand how to train it , what kind of data should I prepare, and how to rectify distored text images

WarBean commented 6 years ago

You do not need to prepare data for running my code, because PyTorch's API already provides data loading functionality. However, if you want to use your own dataset, you should implement your customized dataloader. Please refer to http://pytorch.org/tutorials/beginner/data_loading_tutorial.html.

Lesley96-11 commented 6 years ago

@WarBean Thanks for your advice. I want to input a distorted text image ,and the output is a rectified picture. How to achieve it. Can your program achieve that?

WarBean commented 6 years ago

Please check this line: https://github.com/WarBean/tps_stn_pytorch/blob/master/mnist_model.py#L102. The variable transformed_x is the rectified image. You can modify my code to fetch it out.