Skip to content
Permalink
Browse files

init

  • Loading branch information...
bj80heyue committed Aug 4, 2019
1 parent 6b30917 commit ee3fbb3b1fbb96f4c10bde0c9e20fe9c3d17905f
Showing with 3,984 additions and 0 deletions.
  1. +65 −0 README.md
  2. BIN data/poseGuide/imgs/pose_1.jpg
  3. BIN data/poseGuide/imgs/pose_2.jpg
  4. BIN data/poseGuide/imgs/pose_3.jpg
  5. +6 −0 data/poseGuide/lms_poseGuide.out
  6. BIN data/reference/imgs/ref_1.png
  7. BIN data/reference/imgs/ref_2.png
  8. BIN data/reference/imgs/ref_3.png
  9. BIN data/reference/imgs/ref_4.png
  10. BIN data/reference/imgs/ref_5.png
  11. +10 −0 data/reference/lms_ref.out
  12. +18 −0 fusion/README.md
  13. +196 −0 fusion/affineFace.py
  14. +63 −0 fusion/calcAffine.py
  15. +51 −0 fusion/parts2lms.py
  16. +247 −0 fusion/points2heatmap.py
  17. +26 −0 fusion/test.py
  18. +116 −0 fusion/warper.py
  19. 0 loader/__init__.py
  20. +140 −0 loader/dataset_basic.py
  21. +102 −0 loader/dataset_loader_demo.py
  22. +200 −0 model/base_model.py
  23. +192 −0 model/spade_model.py
  24. +342 −0 net/ResNet.py
  25. +83 −0 net/appear_decoder_net.py
  26. +142 −0 net/appear_encoder_net.py
  27. +82 −0 net/base_net.py
  28. +133 −0 net/discriminator_net.py
  29. +170 −0 net/face_id_mlp_net.py
  30. +33 −0 net/face_id_net.py
  31. +266 −0 net/generaotr_net.py
  32. +201 −0 net/generator_net_concat_1Layer.py
  33. +55 −0 net/vgg_net.py
  34. 0 opt/__init__.py
  35. +132 −0 opt/config.py
  36. +18 −0 opt/configTrain.py
  37. BIN output/1.jpg
  38. BIN output/10.jpg
  39. BIN output/11.jpg
  40. BIN output/12.jpg
  41. BIN output/13.jpg
  42. BIN output/14.jpg
  43. BIN output/15.jpg
  44. BIN output/2.jpg
  45. BIN output/3.jpg
  46. BIN output/4.jpg
  47. BIN output/5.jpg
  48. BIN output/6.jpg
  49. BIN output/7.jpg
  50. BIN output/8.jpg
  51. BIN output/9.jpg
  52. BIN pics/lms.png
  53. BIN pics/main.png
  54. BIN runs/test_res/events.out.tfevents.1562825663.g105e1900155
  55. +92 −0 test.py
  56. +1 −0 utils/__init__.py
  57. +20 −0 utils/affineFace.py
  58. +73 −0 utils/affine_util.py
  59. +66 −0 utils/calcAffine.py
  60. +50 −0 utils/lms.test
  61. +12 −0 utils/metric.py
  62. +236 −0 utils/points2heatmap.py
  63. +229 −0 utils/transforms.py
  64. +116 −0 utils/warper.py
@@ -0,0 +1,65 @@
# Learning One-shot Face Reenactment
Official test script for 2019 BMVC paper 'Learning One-shot Face Reenactment' in PyTorch.

## Installation

### Requirements
- Linux
- Python 3.6
- PyTorch 1.0+
- CUDA 9.0+
- GCC 4.9+

### Easy Install
```shell
pip install -r requirements.txt
```

## Getting Started

### Prepare Data
It is recommended to symlink the dataset root to `$PROJECT/data`.
```shell
Project
├── data
│ ├── poseGuide
│ │ ├── imgs
│ │ ├── lms
│ ├── reference
│ │ ├── imgs
│ │ ├── lms
```
- imgs : store images that match lms
- lms : store landmarks extracted from images
- format : 106 common facial key points & 20+20 gaze key points

Example input data is organized in folder 'data'. Please organize your data in the format the same as the example input data if you want to test with your own data.

Output images are saved in folder 'output'.

### Inference with pretrained model
```
python test.py --pose_path PATH/TO/POSE/GUIDE/IMG/DIR --ref_path PATH/TO/REF/IMG/DIR --pose_lms PATH/TO/POSE/LANDMARK/FILE --ref_lms PATH/TO/REF/LANDMARK/FILE
```

```
output sequence:
ref1-pose1, ref1-pose2, ref1-pose3, ... &
ref2-pose1, ref2-pose2, ref2-pose3, ... &
ref3-pose1, ref3-pose2, ref3-pose3, ... &
. . .
. . .
. . .
```

### Pretrained model
You can download the model from [here](https://drive.google.com/open?id=1Wnc2TGwFQM4PdCdeSn-trI75UeGbuY_E)

### Visualization of results
You can download our sample data and corresponding results from[here](https://drive.google.com/open?id=1Ia8YJrtYTvNRwBfcKK7iBSAf5vb8gkqw)






Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
pose_1.jpg
90.44765716236793 148.92923857343578 91.57595251229804 162.8479934005091 92.9120000469461 176.46386363738992 94.4750702020267 189.95495589886139 97.02199692128647 203.29694912957 99.79529533135087 216.69020667075688 102.741526161524 230.20452567522284 107.24603891660149 243.02974731417868 112.59511909643379 255.8834214948385 119.47399642829623 267.9355943070909 127.98055826477298 278.4243267720386 137.41574048038206 287.8953381465611 147.8454651322761 296.04741539656624 159.34423801793673 301.4650047702521 172.04009073265115 306.14600984182664 184.8476145369723 309.1498658924654 198.1901765257437 309.2894505953745 210.300733963732 306.8638379074362 221.74102561555833 302.8266755169669 232.31119706456093 296.7210222250431 242.4531426761971 288.6321111047236 250.61525106310273 280.1429009636254 257.9335619693902 269.4977033895718 264.79963843573 258.62440630155766 269.747212813302 247.98834091017915 272.8998867302482 235.1301723854457 275.20565595853645 222.93601399814503 277.7970566608542 210.45285890859884 279.74133799998094 197.64873719251972 280.61281413259303 184.5151342861813 281.86739874645264 171.85992721532836 281.4792935965238 158.93559678704815 281.5092061164478 146.28295371195867 114.76937329328939 130.951598068198 128.08263322780795 117.98798787017822 142.75231443631833 115.1611843213403 157.86672034108483 116.6153814472695 173.90706075198796 120.19246576692521 206.74686782862727 121.02894499848259 220.99542433006582 116.48930599229095 236.1074216934221 114.23420102476143 250.73115505761848 115.86996634388765 263.3734861763337 127.31835338341557 191.33970313484292 140.2993282288778 192.45687057588907 153.99556019589238 193.40006374594554 167.7197145214593 194.32236469376062 181.56555264352028 174.32287399383358 199.9117998945228 184.1300182390903 200.7080648332646 194.13823396512498 200.9199239355632 203.11092044225438 199.86497334690608 212.42735582667092 198.39314190081785 131.27202642017005 145.25804889557963 139.60930390659155 138.39140341160612 159.2010831026048 137.80280976717103 166.42600991645304 143.9995468330668 158.77062924567076 148.28800882103064 140.55642625303972 148.86503435426226 213.4374142301142 143.2204520243767 220.39543471642332 136.74147974141397 239.92071927456345 137.12800959501914 247.93163833918334 142.84138090328952 240.00825505051557 147.15669896848198 221.6303427783007 146.4370558472341 128.0094815119112 127.30603943524707 143.35837320872042 124.87580588006517 158.72832845001858 126.4964054707917 173.69199365904 128.65707163001753 207.1552887017947 128.7516632692907 221.6274310617116 125.50257185064652 235.7439188520525 123.88641465163721 250.25624675797326 124.72534010103783 149.3436339426612 135.51948593642157 149.7487980940789 149.8507149705502 149.2291436246387 143.5389557296295 230.21048834458065 134.5325702413665 230.55831327048872 147.71896200290422 230.8006705913076 142.14327359606972 179.39126786362544 141.84649970810392 202.05051090427742 141.56137209773732 173.8039715509792 178.44659547107824 211.45557809523098 178.39411289071995 168.10655914660424 192.04339505424878 217.73949281404384 190.9817893520048 163.77671869691835 245.9297018326953 174.2606984559743 234.04905150188023 188.89939874358288 227.84672346345394 196.7329061228004 228.2799145924343 204.10161247457313 226.22829637685066 215.79634899438292 232.07471557651525 225.75460645391786 242.76781565926217 218.67711851772015 251.95207930554216 208.64262130213024 258.23235688939445 196.93652094532126 261.1568196873806 184.66714682070506 260.51896117531226 172.74227783176593 254.4916159172529 167.5079387479136 245.17813995913383 181.0178831606829 236.37151769034227 196.79519987565118 235.13433671419762 210.26497756865683 235.59731745760598 221.92064485126207 242.76948430139294 209.8973809584047 248.94593227955767 196.5173815999451 251.3505374509133 180.9974006859345 249.87787983113742 149.24129540873582 143.53587629472423 230.8157833355565 142.13912050783574 147.133 140.543 146.515 142.549 145.134 144.308 143.303 145.533 141.195 146.09 139.025 146.064 137.013 145.291 135.327 143.832 134.289 141.928 133.844 140.046 133.787 139.301 134.208 137.402 135.234 135.42 136.895 134.055 138.873 133.177 141.105 132.998 143.193 133.411 145.055 134.593 146.375 136.332 147.056 138.359 211.016 134.501 211.428 135.177 212.929 139.128 215.603 142.521 219.29 144.814 223.556 145.707 227.95 145.317 232.052 143.676 235.325 140.702 237.262 136.833 237.814 132.601 237.099 128.309 235.103 124.352 231.856 121.555 227.845 120.103 223.408 119.916 219.124 120.821 215.37 122.99 212.551 126.254 211.221 130.155
pose_2.jpg
100.093194977701 161.4013559052053 100.53716781745582 174.1857192569044 101.90737024900535 186.330944275622 103.3735344503214 198.64378987292483 106.0354925127567 210.26739998238142 108.63544049277088 222.61087067996962 111.59644983652562 234.0313677912341 115.58285449158832 244.8659427127749 119.6903965821058 256.22302381253576 125.40724643070543 266.6858725541848 132.9721330817453 276.1873768745778 141.3874107390709 284.37879171946804 150.87961259137933 291.7796379709438 161.32208063157066 297.27698204120384 173.02991152939967 301.9868103222333 183.95909621077863 305.35365302459354 195.7679601753028 306.2800992849018 208.18786280319534 305.7388693777715 219.90713032948378 302.63420928143375 231.0674983570704 298.4270380602661 241.87467583557293 292.4041270658705 251.11430378350548 284.80162413595906 259.75921009425394 275.4774005034841 267.5936934573682 265.5298987339355 273.10328426726045 254.9936831616392 276.9043510885375 242.3450654350767 279.6842731168115 230.00664245652425 282.2207554656838 217.85061671549514 283.6271167176647 205.31749176197863 284.91158825286465 192.74645559564587 286.28405217837695 180.92652850754328 286.4006652981046 168.26830468338156 286.37802009263464 156.15744637477152 115.4900160996773 125.082193502199 125.97839064692833 111.80204842041258 140.26601488172514 106.87664397110419 155.14218390910088 106.70852137040197 169.09935687644764 110.27262179717772 206.40394643424622 109.51418879556448 220.59279429423606 105.65324388595778 235.85397794810945 105.46019037708922 250.0199630890238 110.31695931104736 261.8146174979548 122.08371614206064 188.27026113905077 141.11795251994283 188.94549470038856 155.79707940298127 189.08404129537774 170.40651295539388 189.0338830757779 185.08851954718264 171.16007470459334 206.46071102387398 180.93779563127492 207.0502404698997 190.87321681074877 206.35219052398807 200.97355808008274 204.79966402335427 211.08925122271853 204.3564037192203 129.99709531216052 146.82516613202017 138.45895319487153 138.65812639817906 158.9199691214858 139.59960169134345 165.7290131584893 147.94525838106998 156.7653382067972 151.544880685268 138.46813920180864 150.68082990304023 212.80803931969268 146.85949161785712 219.26231272640433 138.08401938986523 239.75751734527222 136.58540730340738 248.649051930705 143.87512069902633 240.21094885731281 148.74329648092575 221.15190422708247 149.42092601802844 126.86960645378379 120.33246236674327 140.8901007864652 116.54432321777693 154.93940323118028 117.14727923840363 168.52913532187097 118.78941690089661 207.75083328136253 118.21893080257749 222.02013148499196 115.72501499112207 236.30085682138304 115.43394613063205 249.963450327016 118.47854574588834 148.87490777257472 135.70718113818126 147.59434754904237 152.29876550495365 148.03748477546577 145.4896501933588 229.46599844979602 134.41317010619932 230.84721286967346 149.98417040083237 230.72517795734979 143.7379041389614 177.48241144005863 144.42981886262302 200.57731720506337 143.59579850675797 171.84385977785854 184.30467672499688 208.85265199799937 182.28690286702104 164.7157107525598 198.3152809435389 216.5810910941354 196.00943146426206 162.08994193115757 242.61385974228384 172.0858024620631 231.3517041461669 184.59666727117178 225.07210003155583 192.4492468801826 226.01037622068648 200.5588240919513 224.77790926122546 213.2634454736595 229.9549048592879 224.9381988568802 240.3493923009241 215.6243032223897 247.39660041613203 205.36281791541535 252.38760036802856 193.5081632119767 254.17419095783012 182.49965019869023 253.80076635628163 170.88804392816343 249.59330429304387 167.57043887732817 242.73629516138735 180.19135949493068 238.375810332754 192.85939239711735 237.72187925766596 206.8976616720181 236.7157494378059 219.61588976882643 239.68200286313336 205.99954107757281 239.46004693594395 192.87395458689463 239.71164424499196 180.12457142150345 240.76992809596996 148.06175692301161 145.49601398018515 230.75213110892832 143.74539610046523 151.81004827804105 143.84939898317916 150.63144534208192 145.6441302756924 148.86913851684324 146.98729337759272 146.8314499157171 147.6939404451874 144.67901038421724 147.69476928060448 142.64910917316251 147.06602696415425 141.02872336421495 145.72688544037987 139.94956991302985 143.81564142727416 139.60619050377977 141.69161161706296 139.7873028215118 139.78759526241075 139.95654438421695 139.21832295211956 140.85339649250864 137.5185476486653 142.29640969176268 135.85395234715398 144.20622126850992 134.9262398383987 146.28762452136618 134.58486734190467 148.44938709275277 134.98154598440036 150.30228524201237 135.933428538162 151.69219101976256 137.56935702042549 152.39817535520797 139.56902405102318 152.4303516793084 141.772208047627 220.83087992185017 138.27456575190863 221.03940931940252 140.4295799316757 221.93522532027163 142.46753600857878 223.44225732523256 144.06060385796238 225.3969587320836 145.0880821494304 227.5350677449888 145.46792778177556 229.65563945935935 145.05177339486923 231.56306625944353 143.89634876044013 232.94612166470642 142.1701057576689 233.7429995319805 140.35694118816687 233.86461164644606 139.79091564686422 233.88532984187515 137.84824845062215 233.4031521329124 135.67294387241222 232.13258946772032 133.9224424167932 230.40870849293913 132.67311152665408 228.2875682138373 132.0047132346189 226.16157424927616 131.9614449361577 224.10586896110965 132.72545572561967 222.45252030932784 134.1380106049866 221.29291179707224 136.12143267485757
pose_3.jpg
100.68002376329395 153.79703744153008 101.4051291762957 167.29352731036488 102.36608555212445 180.38026696181367 103.5115085866463 193.2796673806298 105.60208513182278 206.22525492792363 108.05407168715283 219.1911996360299 110.72916034828148 232.04327056505645 114.662128816159 244.31299676982297 119.22729693999361 256.96663174064025 124.91038003602449 268.85800394432505 132.06981400976326 280.20769626878973 140.08399028936486 290.3547602041902 149.26992550691995 299.5458046262653 159.67522608282252 305.8702960749566 171.6053687509525 310.79222087866896 183.76463958488898 314.0718881616237 196.40643310382438 314.9296751937251 209.08260222463787 312.7460533253202 221.08109456329373 309.46714244205816 232.5904138851381 304.34993137439795 243.38614067947708 296.72779844763835 251.95556374662897 287.92424367136994 259.56128384934743 277.37881002812264 266.6055223864016 266.02289533102015 271.8223444494196 255.0853207857532 275.6882976698365 241.69952614724372 278.1332311458493 229.07474592014216 280.865130942551 216.16749828113603 282.6715383437519 203.17098731003347 283.4855144423068 189.7047846995279 284.54365417249846 176.60752783316747 284.2440201782424 163.29309326444684 284.41190175601093 150.34890426294282 119.32299327945958 131.65871208074068 131.24354204447127 119.4271237085135 144.7233606197231 116.76436231641082 158.3771063414871 117.49771461977107 172.81182338036558 120.10444812210659 203.4335669303016 118.8589482271039 217.87278465955853 115.02702907304996 232.91907468182228 113.44929822161964 247.31294938041242 115.33190812950377 260.2315024010835 126.97841904273312 188.22273343612926 139.3076198752563 188.63686152102878 152.0386047432662 188.7611761515883 164.79384529821388 188.91978090528823 177.55227075180463 169.7111954193623 196.77551803916765 180.06821536557868 197.67351115261314 190.63790976752796 197.7888044966272 200.8804305939036 196.19666268162234 211.24318198311573 194.77596339340437 132.59280263568814 145.38064500335693 140.33753945021442 139.0346919634389 158.93063754126615 138.179268931794 166.69930149762808 143.11074009078462 159.10171084791972 147.3394655494072 141.46611287868313 148.17486895478004 211.87448685223558 141.32109648552972 218.99927225556576 135.38629032260937 238.14200872137235 135.77969758234636 246.3949750306624 141.10883871630253 238.28261153261315 144.81048398646308 219.98203674843285 144.61163538712265 131.35538709568743 128.44829961151106 145.3210348187722 126.39810197004851 159.1387735034233 127.31037555545663 172.68949902201916 128.8156827288658 203.93057601866838 127.37584575978363 218.4936246992536 124.46089694241138 232.73524799057964 123.07160759666456 247.05706726507663 124.18618894799454 149.47918521005658 136.43638963621842 150.41669906636992 148.76269602136756 149.83792696451576 143.299579440643 228.63413541056707 133.3277985159665 228.90817521054475 145.45268978778392 229.24034281706986 140.37335793597077 177.9319146074116 140.92273666581062 199.7174690978967 140.0987596833736 169.30041816138362 174.84747082055745 210.38993478839757 173.7937801486287 163.225771472235 188.3553133264286 217.35450961702531 186.66968050371196 160.1394551245839 242.89775811526653 168.54736414930602 225.85190441340148 184.2487138192256 217.81560362723332 192.7308484038665 217.93019388434595 200.94263381193832 216.52182806789176 217.13170151835243 223.50943332277305 228.81417226616497 239.95764581058992 219.63434860680593 251.1279338845803 207.24764191007648 257.99722671866533 193.60312998843597 260.80504085767797 180.81085488093902 259.80105624440637 168.6046248037361 253.04358964232298 164.01974631861418 241.9637881083339 175.805269270773 228.99728727707162 192.6064447100979 225.38489739724236 210.80045024409787 227.89017795717766 224.7944515525944 239.57564391391026 209.9331052046141 247.97277555588565 193.54048661491902 251.31926099718322 177.56903552895676 248.71010475718293 149.84582414347676 143.2984574691387 229.2632446360568 140.37010421860836 154.301461172647 141.28211941410973 153.98117099887304 143.8251636812882 152.89421223464961 146.2853838191459 151.1345283671787 148.25224364347358 148.80387764360444 149.42124922459743 146.23896934961363 149.66158067587995 143.84019972098628 148.7576380963099 141.85285060979106 146.94446913051868 140.55571670009954 144.5909333525596 139.88406480440915 142.26213159782014 139.72922406113173 141.18360134604575 139.81607205312503 138.8517732020959 140.515012731171 136.2065936517422 142.06859816590202 134.099020893086 144.20611444560933 132.65372132086355 146.81577006048656 132.16694641865024 149.30762030185718 132.6089132914571 151.4890601731642 134.0416290964237 153.06288105736593 136.13107669270323 154.0035887610266 138.58439595152163 215.59932696651867 137.60874451806953 216.85701835983605 139.9114879293186 219.56175336875458 143.1107864900333 223.08959800249056 145.3157822728301 227.1133598042387 146.31031579493748 231.25404792720292 146.05235790736765 235.10368937026135 144.48868952422154 238.22739565617837 141.6545095990617 240.1139335953012 137.84722886724492 240.63358006265992 133.6508493395479 239.9784498785409 129.64070899264615 238.04789058947233 125.85688882307153 234.99614525947288 122.83499049133499 231.17294812335706 121.25605822396645 227.08449592576687 120.91765881391294 222.96594299710102 121.87581135122085 219.39622629853466 123.95239154343281 216.78751784202973 127.16779559194907 215.28458818424303 131.02692301680122 214.9035510490429 133.3522078497409
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ee3fbb3

Please sign in to comment.
You can’t perform that action at this time.