sergeywong / cp-vton

Reimplemented code for "Toward Characteristic-Preserving Image-based Virtual Try-On Network"
MIT License
474 stars 182 forks source link

AffineGridGen not used #18

Closed solitarysandman closed 4 years ago

solitarysandman commented 5 years ago

Hi @sergeywong,

While AffineGridGen is defined in the networks module, it is not used anywhere for affine warping. How can we incorporate this into TpsGridGen (TPS)?

Where would we need to make the changes in init and forward?

VyBui commented 4 years ago

@solitarysandman why is this issue closed?

solitarysandman commented 4 years ago

I solved it by tweaking the code using pytorch ST networks tutorials as guide: https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html

solitarysandman commented 4 years ago

Changes are as follows:

  1. Change output_dim in Feature Regression to 6, because affine has 6 parameters of the shape (2,3)
  2. Convert these 6 outputs to the shape of (2,3)
  3. Use theta created in step 2 to run affinegridgen to obtain grid
  4. Use grid_sample as before to get warped results
levindabhi commented 4 years ago

@solitarysandman Sorry if it's a dumb question, but why we need to generate grid through affinegridgen rather than Tpsgridgen?