├── .gitignore ├── .vscode └── launch.json ├── README.md ├── data └── output │ └── preds │ └── distances.txt ├── header.png ├── main.py └── model ├── L0.pkl ├── L1.pkl ├── L10.pkl ├── L11.pkl ├── L12.pkl ├── L13.pkl ├── L14.pkl ├── L2.pkl ├── L3.pkl ├── L4.pkl ├── L5.pkl ├── L6.pkl ├── L7.pkl ├── L8.pkl ├── L9.pkl ├── regressor0.pkl ├── regressor1.pkl ├── regressor10.pkl ├── regressor11.pkl ├── regressor12.pkl ├── regressor13.pkl ├── regressor14.pkl ├── regressor2.pkl ├── regressor3.pkl ├── regressor4.pkl ├── regressor5.pkl ├── regressor6.pkl ├── regressor7.pkl ├── regressor8.pkl ├── regressor9.pkl └── theta.pkl /.gitignore: -------------------------------------------------------------------------------- 1 | *.npy 2 | 3 | /.vscode/.ropeproject 4 | 5 | /data/output/png -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [{ 7 | "name": "train with CAD-60 and rtw model", 8 | "type": "python", 9 | "request": "launch", 10 | "program": "${file}", 11 | "console": "integratedTerminal", 12 | "args": ["--dataset", "CAD-60", "--input-dir", "data/input"] 13 | }, 14 | { 15 | "name": "load model to predict CAD-60", 16 | "type": "python", 17 | "request": "launch", 18 | "program": "${file}", 19 | "console": "integratedTerminal", 20 | "args": ["--dataset", "CAD-60", "--input-dir", "data/input", "--load-model"] 21 | }, 22 | { 23 | "name": "Python: Module", 24 | "type": "python", 25 | "request": "launch", 26 | "module": "enter-your-module-name-here", 27 | "console": "integratedTerminal" 28 | }, 29 | { 30 | "name": "Python: Current File (External Terminal)", 31 | "type": "python", 32 | "request": "launch", 33 | "program": "${file}", 34 | "console": "externalTerminal" 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Depth Pose Estimation And Action Recognition 2 | > This project is a simple modification to https://github.com/ddxue/depth-pose-estimation project. 3 | 4 | Train models to predict body parts or joints. 5 | 6 | Action recognition program has not yet been complete. 7 | 8 | ![](header.png) 9 | 10 | ## Usage example 11 | 12 | If you want to train quickly with CAD-60 dataset, you could use the following command. 13 | 14 | The parameter **--input-dir** is the location of npy file. 15 | ```sh 16 | python main.py --dataset CAD-60 --input-dir data/input 17 | ``` 18 | If you want to predict the joints position with model trained by me, use this: 19 | ```sh 20 | python main.py --dataset CAD-60 --input-dir data/input --load-model 21 | ``` 22 | 23 | For vscode users, you could just use **launch.json** as default debug parameter 24 | ```json 25 | "configurations": [{ 26 | "name": "train with CAD-60 and rtw model", 27 | "type": "python", 28 | "request": "launch", 29 | "program": "${file}", 30 | "console": "integratedTerminal", 31 | "args": ["--dataset", "CAD-60", "--input-dir", "data/input"] 32 | }, 33 | { 34 | "name": "load model to predict CAD-60", 35 | "type": "python", 36 | "request": "launch", 37 | "program": "${file}", 38 | "console": "integratedTerminal", 39 | "args": ["--dataset", "CAD-60", "--input-dir", "data/input", "--load-model"] 40 | }] 41 | ``` 42 | ## Development setup 43 | 44 | Install all development dependencies 45 | 46 | ```sh 47 | pip install sklearn 48 | pip install numpy 49 | pip install pickle 50 | ``` 51 | 52 | ## Content of this project 53 | ``` 54 | DEPTH-POSE-ESTIMATION 55 | │ .gitignore 56 | │ contents.txt 57 | │ header.png 58 | │ main.py 59 | │ README.md 60 | │ 61 | ├─.vscode 62 | │ │ launch.json 63 | │ │ 64 | │ └─.ropeproject 65 | │ 66 | ├─data 67 | │ ├─input 68 | │ │ depth_images.npy 69 | │ │ joints.npy 70 | │ │ 71 | │ └─output 72 | │ ├─png 73 | │ │ *.png 74 | │ │ 75 | │ └─preds 76 | │ distances.txt 77 | │ 78 | └─model 79 | L0.pkl 80 | L1.pkl 81 | L10.pkl 82 | L11.pkl 83 | L12.pkl 84 | L13.pkl 85 | L14.pkl 86 | L2.pkl 87 | L3.pkl 88 | L4.pkl 89 | L5.pkl 90 | L6.pkl 91 | L7.pkl 92 | L8.pkl 93 | L9.pkl 94 | regressor0.pkl 95 | regressor1.pkl 96 | regressor10.pkl 97 | regressor11.pkl 98 | regressor12.pkl 99 | regressor13.pkl 100 | regressor14.pkl 101 | regressor2.pkl 102 | regressor3.pkl 103 | regressor4.pkl 104 | regressor5.pkl 105 | regressor6.pkl 106 | regressor7.pkl 107 | regressor8.pkl 108 | regressor9.pkl 109 | theta.pkl 110 | ``` 111 | **depth_images.npy** and **joints.npy** is the preprocessed dataset -------------------------------------------------------------------------------- /data/output/preds/distances.txt: -------------------------------------------------------------------------------- 1 | 0.554 0.784 0.659 1.078 1.061 0.981 0.572 0.841 2.152 0.758 21.288 2.587 0.840 0.739 0.483 2 | 1.287 0.675 1.268 2.046 1.406 0.681 1.181 0.546 1.564 0.994 9.956 1.627 0.685 1.139 1.537 3 | 1.077 0.975 0.794 0.389 1.548 1.715 0.174 0.694 1.392 1.178 10.129 2.127 1.356 1.754 1.398 4 | 0.948 0.949 0.439 1.711 1.712 0.520 1.077 0.283 1.009 0.910 8.565 1.392 0.778 0.406 1.501 5 | 1.216 1.196 1.053 1.600 0.740 0.540 3.818 1.298 0.975 0.935 37.552 4.600 0.679 0.216 1.462 6 | 1.196 1.270 1.154 1.593 0.743 1.440 0.747 0.076 0.766 0.790 4.130 1.134 0.785 0.582 0.236 7 | 1.209 0.423 0.621 1.065 0.181 0.939 0.726 0.743 2.335 0.483 4.964 1.138 0.640 0.616 0.300 8 | 0.314 0.335 0.411 1.374 0.328 1.008 1.733 0.906 1.757 0.713 4.278 0.917 1.290 0.794 0.302 9 | 0.992 1.034 1.256 1.121 0.412 0.881 1.974 1.125 2.252 1.111 14.548 2.083 0.857 0.579 0.277 10 | 0.947 1.019 0.655 1.179 0.464 1.059 1.868 0.884 0.803 0.737 3.483 0.677 0.998 0.532 0.332 11 | 1.266 1.118 0.745 1.055 0.514 2.011 1.787 1.221 1.267 0.794 3.833 0.851 1.251 1.189 0.271 12 | 1.150 0.296 0.970 1.237 0.705 0.718 1.905 1.714 1.323 1.038 7.338 0.881 1.321 0.858 0.357 13 | 1.030 0.777 0.616 1.776 1.688 0.946 1.066 0.407 0.651 0.437 13.336 1.609 0.486 1.000 0.848 14 | 0.266 0.394 0.293 0.790 0.642 0.889 1.905 1.810 2.188 0.767 13.585 1.777 1.047 0.621 0.202 15 | 0.110 0.654 0.148 0.949 1.031 1.001 2.425 2.276 2.034 0.826 5.189 0.646 1.014 0.509 0.540 16 | 0.256 0.476 0.566 1.226 0.089 1.020 1.738 2.389 2.336 0.524 4.468 1.268 1.157 1.055 0.385 17 | 0.428 0.189 0.248 1.197 0.773 0.896 1.516 1.103 2.333 1.203 5.656 0.670 0.902 0.453 0.730 18 | 1.119 0.323 0.449 2.157 0.559 0.813 1.908 1.845 2.297 0.848 3.886 0.455 0.695 0.490 0.932 19 | 0.369 0.338 0.678 1.898 1.133 0.217 1.707 2.009 1.668 0.556 6.589 0.857 1.026 0.605 1.424 20 | 0.756 0.458 0.747 2.048 0.672 0.455 2.300 0.736 1.870 0.812 5.691 0.748 1.078 1.389 0.235 21 | 0.990 0.533 0.759 2.009 0.861 1.154 2.202 0.990 2.058 0.775 5.426 0.670 0.947 1.509 0.924 22 | 0.301 0.222 0.152 0.837 0.524 0.889 1.862 0.978 2.592 0.959 25.954 2.700 1.074 1.101 0.882 23 | 0.085 0.334 0.286 2.121 0.704 0.854 1.959 0.887 2.237 0.994 5.773 1.087 0.952 0.872 0.315 24 | 0.885 0.571 0.928 0.952 0.561 0.602 1.839 0.462 1.041 0.950 7.597 1.207 0.668 1.526 1.000 25 | 0.432 0.414 0.572 0.789 0.529 0.543 1.869 1.202 1.501 0.999 9.512 0.859 0.647 0.384 0.087 26 | 0.465 0.411 0.542 1.587 0.497 0.726 1.191 0.670 2.380 0.275 8.658 0.901 0.695 0.947 1.723 27 | 0.372 0.235 0.655 1.549 0.540 0.305 1.774 1.394 2.193 1.103 3.695 0.825 0.417 0.680 1.240 28 | 0.244 1.233 0.261 0.793 0.673 1.856 2.087 1.838 2.168 0.970 16.570 1.715 0.557 1.343 0.771 29 | 1.099 1.140 1.540 0.969 0.220 1.023 0.779 1.057 1.850 1.287 35.560 64.387 0.117 0.661 0.625 30 | 1.181 1.189 1.090 1.851 0.503 1.561 1.073 0.093 1.013 1.046 13.453 1.527 1.154 1.548 1.409 31 | 0.970 1.196 0.602 1.900 0.401 1.676 0.083 0.256 1.076 0.662 8.148 0.971 0.569 1.436 1.417 32 | 1.189 1.481 1.372 2.097 0.594 2.686 0.167 0.534 1.218 0.296 3.311 0.881 0.500 1.570 0.561 33 | 0.521 0.967 1.282 1.774 0.514 1.326 0.122 0.886 0.893 0.333 37.437 4.319 0.900 0.454 0.808 34 | 0.629 1.302 1.038 2.069 0.342 1.649 2.337 0.770 1.048 0.928 2.487 1.209 0.798 0.529 1.022 35 | 0.641 0.806 0.844 0.881 0.833 1.236 1.493 0.999 1.426 1.555 9.251 1.636 0.802 1.067 0.490 36 | 0.793 0.761 1.267 1.024 0.215 1.512 1.147 0.433 1.163 0.915 10.506 1.586 0.698 0.554 0.832 37 | 0.174 0.316 1.503 1.044 0.150 1.509 0.990 0.307 1.216 0.967 11.449 1.420 0.822 0.488 0.053 38 | 0.135 0.145 0.591 1.600 0.454 1.144 1.232 0.421 2.209 1.355 28.877 3.203 0.481 1.309 0.587 39 | 0.391 0.798 0.237 1.137 1.256 0.579 1.098 1.515 2.079 0.865 15.993 1.659 0.424 1.261 0.792 40 | 1.310 1.146 0.742 1.962 2.123 1.137 2.764 1.828 3.024 0.938 4.301 1.126 0.585 1.756 1.276 41 | 1.443 1.127 0.915 2.355 1.798 1.291 2.001 2.448 3.201 0.836 17.540 1.510 1.283 2.196 0.538 42 | 1.492 0.729 1.277 1.979 1.863 1.115 3.413 2.101 2.831 1.329 8.849 1.486 1.168 2.398 1.049 43 | 1.156 0.731 0.877 1.740 2.420 1.193 1.758 2.588 2.762 0.772 32.779 13.922 1.518 1.829 0.901 44 | 1.149 2.312 0.840 2.458 2.345 0.836 2.554 2.339 3.004 1.014 19.157 2.163 1.309 1.814 1.894 45 | 1.389 2.232 0.802 1.870 2.318 1.119 3.818 3.153 2.624 0.798 6.109 1.208 1.908 3.176 1.433 46 | 1.019 0.480 0.856 1.961 1.546 0.202 1.820 2.276 1.498 0.797 26.932 2.926 0.403 1.193 0.633 47 | 1.319 1.064 0.604 1.472 1.883 1.555 3.604 3.311 3.206 0.584 4.728 0.741 1.514 3.477 0.859 48 | 1.339 0.968 0.561 2.251 1.869 2.172 2.812 2.537 2.468 0.895 12.616 1.662 1.678 2.191 1.022 49 | 1.309 0.925 0.850 1.868 1.829 1.088 1.940 2.401 2.507 1.026 11.889 1.463 1.354 2.036 0.961 50 | 1.624 0.942 1.058 1.364 2.154 1.287 2.752 2.812 3.146 1.214 5.704 0.812 1.599 1.846 0.788 51 | 1.527 1.234 0.739 2.026 2.264 2.155 2.200 1.611 3.483 1.006 23.362 2.369 1.592 2.216 1.001 52 | 1.460 1.039 0.512 2.147 2.092 1.419 2.093 2.525 2.989 0.815 5.945 0.821 2.016 2.137 1.726 53 | 1.757 0.650 0.892 2.175 1.349 1.322 2.835 2.857 3.113 0.745 21.196 2.506 1.381 2.061 1.328 54 | 0.721 0.808 0.453 1.295 1.555 0.668 2.099 1.357 1.586 0.759 14.929 0.753 1.717 1.651 0.744 55 | 0.706 1.315 0.329 1.144 1.021 1.079 1.581 0.771 2.189 1.577 7.461 1.018 0.635 0.695 1.423 56 | 0.607 1.046 0.271 1.234 1.560 0.283 3.084 2.001 1.631 0.771 5.908 1.429 0.918 1.453 1.237 57 | 1.236 0.785 1.168 2.366 2.171 1.151 1.439 0.719 0.812 1.008 37.234 4.214 0.433 0.802 1.216 58 | 1.439 1.380 0.417 1.376 1.783 0.680 3.045 3.228 2.031 0.639 25.515 2.684 0.763 1.303 0.520 59 | 1.663 1.301 0.532 2.070 1.314 1.344 2.622 1.667 1.593 0.768 7.514 1.116 0.917 1.564 1.305 60 | 1.403 1.001 0.786 2.089 2.701 0.990 2.256 1.779 2.713 1.175 6.612 1.263 1.408 2.200 1.861 61 | 1.249 1.475 0.935 2.232 2.684 1.562 1.252 1.592 3.100 0.874 10.924 0.805 1.631 1.934 1.723 62 | 1.497 1.409 0.955 2.064 1.971 0.724 2.556 1.783 2.836 0.910 4.673 0.840 1.789 1.474 1.307 63 | 1.194 1.168 0.567 3.088 2.623 1.455 2.181 2.146 3.313 0.743 16.511 1.924 1.395 2.278 1.512 64 | 1.477 1.345 0.953 1.317 2.232 0.998 2.255 1.443 2.959 0.522 9.237 1.182 1.732 1.961 1.314 65 | 1.766 1.573 0.681 1.460 2.422 0.724 2.259 1.213 2.761 0.713 9.895 1.116 1.660 1.924 1.132 66 | 1.385 1.523 0.620 1.889 2.354 1.960 2.192 2.191 3.364 0.925 11.449 1.340 1.463 2.270 1.103 67 | 1.628 2.452 0.606 2.085 2.796 0.686 3.219 2.548 3.588 0.894 8.483 0.813 1.096 1.653 1.867 68 | 0.458 0.461 0.525 1.449 0.776 0.909 1.101 0.453 1.341 0.793 12.563 1.313 0.468 1.034 0.315 69 | 1.711 1.344 0.737 2.146 2.316 1.584 3.668 2.658 2.739 0.825 9.010 0.828 1.276 1.950 1.030 70 | 1.400 2.086 0.541 2.165 2.753 1.101 1.933 2.444 3.013 1.141 10.463 1.670 1.667 1.976 2.823 71 | 1.491 1.478 0.863 1.483 2.192 1.447 3.347 2.799 3.144 0.846 5.720 0.525 1.575 1.718 1.323 72 | 1.630 1.341 0.517 2.395 2.265 1.290 3.124 2.248 3.243 0.898 34.038 3.374 1.602 2.385 0.724 73 | 1.455 0.936 1.643 2.004 2.537 2.042 2.207 2.354 2.953 1.190 11.580 1.154 1.539 2.074 0.959 74 | 1.858 1.052 0.727 1.525 2.676 1.577 2.027 2.289 3.246 0.813 11.036 1.187 1.235 1.651 0.843 75 | 1.510 1.329 1.048 1.978 2.804 1.243 2.245 2.614 3.369 1.243 6.181 0.801 1.897 1.792 1.535 76 | 1.631 1.163 0.958 1.740 2.428 0.973 1.975 4.270 3.010 0.804 10.293 1.218 1.871 1.916 0.693 77 | 1.224 0.950 0.606 1.795 1.747 0.797 2.185 2.724 2.621 0.754 7.588 1.089 1.227 1.814 1.700 78 | 1.540 1.115 0.662 1.977 1.775 1.257 3.003 2.182 2.213 1.157 3.766 1.027 0.607 2.137 0.653 79 | 0.713 0.373 0.959 1.006 0.799 1.176 1.860 0.511 1.230 0.802 22.900 2.287 0.513 1.280 0.765 80 | 0.685 0.874 0.582 0.826 1.717 0.303 1.569 1.410 2.008 1.663 6.175 0.971 0.964 2.012 1.331 81 | 0.800 0.706 0.993 0.398 1.167 0.862 0.579 1.808 1.910 1.250 5.628 0.872 0.877 1.418 1.036 82 | 0.626 1.103 1.311 0.170 1.470 1.240 0.600 0.705 1.524 0.992 7.541 1.044 0.175 0.519 1.220 83 | 0.692 1.187 1.156 0.921 0.478 1.017 0.531 0.152 0.993 0.468 4.992 1.043 1.018 0.483 2.349 84 | 0.744 1.317 1.115 0.057 0.378 0.663 0.957 1.336 1.652 0.426 3.327 0.857 0.737 0.897 1.463 85 | 0.844 1.629 1.294 0.671 0.522 0.888 0.290 0.790 1.233 0.264 4.074 0.774 0.300 0.553 0.478 86 | 0.573 0.777 0.243 0.987 0.831 0.849 0.721 0.212 2.066 0.178 24.421 3.091 0.635 0.948 0.691 87 | 0.542 0.318 0.620 0.986 0.629 0.741 0.495 0.173 2.587 0.941 5.175 0.782 1.129 0.884 1.210 88 | 1.477 0.999 0.583 1.885 0.735 0.742 1.597 0.984 3.103 0.911 18.755 1.898 1.143 1.218 0.056 89 | 1.760 0.802 0.918 2.120 0.674 1.456 1.668 2.162 2.333 1.426 5.781 0.903 0.779 0.471 0.203 90 | 0.546 0.317 0.901 1.919 1.837 0.932 0.897 0.706 1.584 1.333 10.075 1.389 0.989 0.647 0.996 91 | 1.063 0.735 0.226 1.315 0.841 0.909 2.006 1.084 2.558 0.810 5.089 1.077 1.340 2.292 0.754 92 | 1.492 0.162 0.380 0.832 0.661 0.741 0.559 1.120 2.425 0.149 10.779 1.360 1.184 1.223 1.036 93 | 1.191 0.500 0.435 0.958 0.598 0.681 0.782 0.564 2.371 0.854 12.035 1.721 0.824 1.480 0.569 94 | 1.350 0.526 0.679 1.300 0.207 0.827 1.112 0.821 2.283 1.261 2.973 0.786 0.914 1.422 1.243 95 | 1.921 0.975 1.185 1.330 1.716 0.752 0.998 1.244 2.630 0.942 9.966 1.353 1.012 1.568 0.835 96 | 1.817 1.089 1.110 1.778 1.004 1.883 0.491 1.045 2.979 1.255 6.931 0.932 0.764 2.168 0.510 97 | 2.168 0.932 0.357 2.169 2.024 0.923 1.661 1.268 3.351 1.068 5.143 0.527 1.530 1.653 0.840 98 | 1.417 0.699 0.639 1.383 1.489 1.068 1.492 0.979 3.107 1.274 35.800 4.666 1.753 2.789 1.046 99 | 1.771 0.777 0.620 1.585 2.190 1.455 1.673 2.034 2.965 1.059 12.052 1.150 1.981 1.932 0.066 100 | 1.572 1.117 0.443 1.648 1.830 1.568 1.759 1.868 3.000 0.826 4.120 0.471 1.582 1.825 0.585 101 | 0.401 0.319 0.761 1.856 1.420 1.104 1.077 0.291 0.995 1.001 4.596 1.009 0.930 1.117 0.216 102 | 1.188 0.947 0.615 2.264 2.071 0.956 1.570 2.035 3.479 0.847 12.993 1.870 1.958 2.078 0.183 103 | 1.824 1.019 0.994 2.168 1.789 1.797 1.279 1.348 3.456 0.056 10.562 0.919 2.023 2.309 1.541 104 | 1.812 0.797 0.902 1.191 0.972 1.111 1.736 1.408 2.785 0.240 7.681 1.001 2.116 1.828 0.856 105 | 1.890 0.918 0.177 0.893 0.881 1.204 1.675 0.842 2.906 0.136 9.267 1.512 0.968 2.284 1.087 106 | 0.675 0.958 0.255 1.125 0.241 1.442 1.667 0.793 2.893 1.229 4.883 0.887 0.986 1.906 0.375 107 | 1.336 1.214 0.186 1.301 0.619 1.397 1.839 1.030 2.241 0.209 5.279 0.928 0.740 1.687 1.155 108 | 0.754 1.326 0.287 0.960 0.870 1.661 1.392 1.197 2.877 0.407 16.097 1.554 0.938 1.626 1.432 109 | 0.570 1.060 0.476 1.918 0.852 1.487 1.638 1.178 2.179 0.261 31.061 3.649 1.281 1.303 1.124 110 | 0.635 0.964 0.226 1.941 0.629 1.852 0.479 1.157 1.362 0.280 4.591 1.053 1.613 1.400 0.461 111 | 1.855 1.452 0.632 1.929 0.640 1.579 1.691 0.919 2.466 0.365 14.419 2.409 1.772 1.193 0.485 112 | 0.541 0.526 0.585 0.893 1.147 1.124 0.526 0.984 0.651 1.006 1.946 0.794 0.795 0.558 0.361 113 | 0.445 0.219 0.417 2.444 1.561 1.073 1.622 0.889 1.697 0.613 3.950 1.176 0.741 0.449 0.990 114 | 1.286 1.259 0.515 1.139 0.642 2.214 1.961 1.116 3.076 0.823 22.463 3.574 1.142 1.265 1.621 115 | 0.673 0.836 0.570 1.290 0.725 1.137 1.462 1.225 3.484 0.966 6.958 1.686 1.178 1.559 0.622 116 | 0.536 0.717 0.045 1.282 0.390 0.663 2.083 1.255 1.965 0.357 13.220 1.823 0.886 1.704 1.852 117 | 0.751 0.827 0.522 1.114 0.602 1.042 2.445 1.037 2.395 0.791 5.630 2.142 1.259 0.677 0.548 118 | 0.746 0.713 0.661 1.711 0.590 0.909 0.608 1.743 1.804 1.103 34.394 4.549 0.728 0.991 0.503 119 | 1.457 0.695 0.467 1.787 1.117 1.023 1.161 1.727 2.635 0.618 7.955 2.130 1.122 0.507 0.242 120 | 1.502 0.996 0.526 1.860 1.701 1.331 1.705 1.953 2.797 0.853 19.379 3.189 1.678 1.606 0.537 121 | 1.268 0.825 0.975 1.747 0.269 0.975 1.669 1.649 3.015 0.544 11.400 0.965 1.831 1.285 1.427 122 | 1.410 1.221 0.457 1.395 0.448 1.175 1.844 1.510 2.810 0.586 7.699 1.015 2.115 2.164 0.855 123 | 1.664 1.063 0.552 1.066 0.737 2.807 1.999 1.143 2.021 0.847 22.026 2.406 0.818 1.216 0.423 124 | 0.782 1.385 0.710 1.459 1.935 1.977 1.088 1.369 1.945 0.690 4.144 0.971 1.369 0.670 1.558 125 | 1.639 1.257 1.033 1.756 1.545 1.053 2.103 1.072 2.729 0.747 34.184 5.481 1.010 2.321 1.080 126 | 1.360 1.276 0.695 2.068 0.098 1.515 1.913 1.485 2.645 0.742 36.480 4.073 2.050 1.561 0.458 127 | 1.175 1.342 0.577 0.409 0.463 0.754 1.714 0.894 2.590 1.141 25.676 2.733 1.279 1.534 1.000 128 | 1.443 1.410 0.717 1.445 0.281 1.606 1.552 0.689 3.380 0.636 13.003 1.605 0.247 1.386 0.456 129 | 1.647 0.818 0.509 1.277 0.686 1.611 1.686 0.642 3.129 0.804 4.738 1.324 0.676 1.785 1.158 130 | 1.188 1.241 0.555 1.874 0.613 1.632 1.796 1.504 2.694 0.717 12.150 1.666 0.778 2.374 0.954 131 | 0.757 1.195 0.230 1.000 0.806 1.247 2.184 1.543 2.664 0.745 7.904 1.535 0.880 1.836 1.335 132 | 0.594 1.223 0.222 1.270 0.751 1.137 1.662 1.018 2.363 1.636 23.389 2.826 0.716 0.896 1.069 133 | 1.079 0.885 0.269 1.190 0.183 1.122 1.737 1.805 2.837 1.250 12.937 1.775 0.900 1.394 1.279 134 | 1.472 0.942 0.555 1.509 0.579 1.898 2.243 1.618 3.375 0.854 20.275 2.517 0.714 1.601 0.649 135 | 0.414 1.313 1.001 0.576 0.958 2.873 2.458 1.447 2.621 1.222 13.925 1.762 0.931 1.770 1.958 136 | 1.301 1.375 0.312 1.071 0.350 1.047 3.044 2.152 3.159 1.181 6.176 1.098 1.107 1.519 0.856 137 | 1.395 1.335 0.293 1.291 0.918 2.064 2.660 1.881 3.227 0.856 12.916 1.950 1.004 1.720 0.459 138 | 1.935 1.242 1.005 1.336 0.853 1.857 2.663 2.195 2.632 0.864 9.093 1.108 1.192 1.180 1.332 139 | 1.580 1.311 1.256 0.589 1.426 1.329 2.676 1.470 3.263 0.866 11.228 1.300 1.386 1.465 1.222 140 | 1.429 1.588 1.207 0.568 1.240 0.741 3.166 2.422 2.695 0.642 20.305 2.421 0.698 1.282 0.869 141 | 0.596 0.502 0.736 0.695 1.103 0.792 2.546 1.967 2.305 0.364 13.762 1.494 0.515 1.785 0.644 142 | 0.510 0.447 1.094 0.909 0.755 0.194 1.899 1.104 2.143 0.748 19.174 2.016 0.289 0.688 0.642 143 | 0.332 0.639 0.583 0.409 0.990 0.347 2.522 1.320 1.973 2.246 7.185 1.286 0.671 0.590 0.392 144 | 0.534 0.523 0.541 0.840 1.510 0.272 1.811 1.639 2.271 0.899 3.127 1.186 1.346 1.000 0.647 145 | 0.479 1.263 0.357 1.119 1.327 0.762 3.140 3.142 2.893 0.748 7.531 1.875 1.188 1.132 0.367 146 | 0.554 1.382 0.661 0.921 1.428 1.478 2.402 1.157 5.146 1.170 16.923 1.508 0.647 2.284 0.938 147 | 1.410 1.760 0.734 0.977 1.336 0.562 1.607 2.228 3.136 0.770 8.177 1.280 1.021 1.850 1.571 148 | 1.320 1.604 0.241 0.878 1.146 1.531 1.905 1.709 3.236 0.910 6.197 0.242 0.594 1.064 1.503 149 | 1.459 1.696 0.184 0.766 1.411 0.730 1.363 1.267 2.976 0.914 6.308 0.663 0.952 1.476 1.382 150 | 1.681 1.732 1.012 0.913 0.555 1.088 1.173 2.334 3.314 0.467 9.880 1.498 0.853 1.946 1.459 151 | 1.686 0.966 1.005 0.631 1.049 0.600 2.956 1.757 3.257 0.825 12.941 1.506 0.518 1.588 1.412 152 | 1.330 1.641 0.887 0.397 1.240 1.934 1.800 1.911 3.110 0.911 7.578 0.629 0.793 1.380 1.233 153 | 0.463 1.761 0.610 0.555 1.013 1.666 3.202 3.560 3.147 0.702 13.844 1.820 0.340 1.547 1.534 154 | 1.618 1.417 0.302 0.425 0.595 0.900 1.338 1.551 2.247 1.125 7.522 1.923 0.486 1.592 1.559 155 | 0.948 1.201 0.155 0.688 1.100 1.118 1.739 1.738 2.741 0.733 12.439 1.108 0.790 1.519 1.314 156 | 1.544 1.321 0.780 0.853 0.975 0.840 2.569 1.435 2.566 1.698 23.681 2.599 1.094 1.094 0.862 157 | 0.583 1.085 1.361 1.320 1.594 1.389 1.825 1.444 2.892 0.806 14.907 1.759 1.810 1.307 1.210 158 | 1.293 2.418 1.152 0.672 1.444 1.788 1.785 1.787 3.060 0.848 9.261 2.139 1.679 1.923 0.882 159 | 1.600 2.336 0.804 1.393 1.532 2.188 1.943 3.723 2.915 0.784 13.380 2.486 1.958 1.172 1.474 160 | 1.154 1.459 0.596 0.824 1.065 1.056 2.189 2.591 3.057 1.771 10.111 2.537 1.422 1.217 0.919 161 | 1.580 1.450 1.269 0.980 1.039 0.628 1.727 1.988 3.200 0.535 27.553 3.524 1.834 1.148 1.214 162 | 0.587 1.240 0.730 0.473 1.092 1.099 4.411 1.637 3.507 0.901 5.169 1.491 1.689 1.496 0.585 163 | 1.366 1.281 0.692 0.434 0.755 0.892 2.115 1.529 3.273 0.611 7.576 2.405 1.448 1.564 1.374 164 | 1.562 1.170 0.069 0.386 0.839 0.726 2.456 2.327 2.997 0.695 7.542 0.872 1.480 1.487 0.413 165 | 1.768 0.945 0.152 0.503 0.794 1.469 2.857 1.729 3.129 0.999 3.947 1.862 0.835 1.732 1.392 166 | 0.424 0.780 0.577 0.589 1.353 1.382 3.326 1.945 3.389 0.955 9.792 2.184 0.795 1.567 0.770 167 | 0.819 1.062 1.122 0.472 1.742 0.155 1.959 2.485 2.124 0.842 12.185 2.696 0.806 1.006 0.408 168 | 0.462 1.689 0.467 1.203 1.608 1.439 2.558 2.060 2.609 0.853 8.720 1.414 1.318 2.026 0.903 169 | 0.490 1.139 1.068 0.784 0.230 0.218 2.210 1.682 1.156 0.981 32.791 5.246 1.063 1.070 1.029 170 | 1.016 0.357 1.219 1.307 0.324 1.180 1.534 0.730 1.411 0.920 4.255 2.047 0.444 0.676 0.650 171 | 0.789 0.680 1.252 1.009 1.142 1.407 0.835 0.341 1.125 0.870 7.060 2.403 0.219 0.826 0.727 172 | 0.916 0.690 1.077 0.711 0.812 0.874 0.935 0.947 1.633 0.860 22.171 3.893 0.373 1.103 1.041 173 | 0.457 0.215 1.486 0.915 0.645 0.855 1.102 1.062 1.332 1.845 7.582 2.595 0.964 0.517 0.380 174 | 0.909 0.661 0.859 0.964 0.856 0.188 0.726 0.904 0.936 0.775 33.078 3.833 0.859 0.112 0.799 175 | 0.671 0.439 0.682 1.044 0.891 0.199 1.841 1.004 1.192 0.823 16.945 1.956 0.988 1.038 0.609 176 | 0.423 0.388 0.246 0.982 0.423 0.164 1.907 0.925 2.011 0.857 9.487 1.316 1.048 1.060 0.507 177 | 0.618 1.544 0.349 0.556 0.346 0.667 1.342 1.007 1.848 0.811 6.692 0.723 1.034 0.422 0.937 178 | 0.887 1.465 0.203 0.769 0.576 0.386 2.323 1.567 2.179 0.869 6.967 2.140 0.892 1.929 1.178 179 | 0.266 0.693 1.802 0.842 1.385 1.904 2.283 2.338 3.418 0.866 34.659 3.911 1.366 1.235 1.285 180 | 0.906 1.520 0.110 0.903 0.977 1.060 1.518 2.075 1.881 0.843 5.394 2.109 0.793 1.392 0.945 181 | 0.725 1.212 0.368 0.545 0.794 0.837 1.831 2.688 2.056 0.981 6.511 2.047 0.867 1.691 0.939 182 | 0.675 1.230 0.254 0.470 0.595 1.099 1.936 2.225 2.043 0.860 6.014 2.443 0.813 1.271 0.652 183 | 0.755 1.296 0.103 0.753 0.570 0.820 1.260 1.861 1.767 2.773 34.866 5.196 0.582 1.602 1.015 184 | 0.784 1.676 0.128 0.216 0.747 0.194 2.561 1.873 2.376 1.906 9.384 1.979 0.947 1.573 1.073 185 | 0.543 1.361 0.337 0.340 1.021 1.017 2.689 1.727 2.263 0.854 10.580 1.977 0.897 1.968 0.493 186 | 0.447 1.421 0.359 0.594 0.575 1.142 2.377 1.859 2.162 1.252 10.000 2.525 1.052 2.432 0.758 187 | 0.558 1.024 0.537 0.442 0.992 1.581 1.846 2.244 1.699 1.240 10.420 2.415 0.981 2.232 0.367 188 | 0.499 1.344 0.338 0.808 1.065 1.299 1.033 1.086 2.388 0.979 31.798 5.111 0.822 2.494 1.446 189 | 1.365 1.620 0.166 1.426 1.523 1.244 1.404 1.563 2.328 1.577 4.766 1.684 0.505 1.636 0.916 190 | 0.426 1.217 1.821 1.138 1.425 2.324 2.887 3.363 2.688 0.849 15.516 2.041 1.437 1.497 0.700 191 | 1.431 1.404 0.391 0.589 1.382 0.750 1.062 1.160 2.056 0.964 24.060 3.633 1.331 2.001 0.318 192 | 0.878 1.213 1.075 0.556 1.680 0.418 3.013 1.652 1.905 0.943 6.152 1.857 1.708 1.850 0.502 193 | 1.276 1.285 1.294 0.530 1.386 1.138 2.645 3.046 1.613 0.604 5.330 1.947 1.672 1.990 0.640 194 | 1.412 1.168 1.126 0.604 1.759 1.224 3.002 1.730 2.890 0.973 49.312 64.406 1.358 1.718 0.557 195 | 1.421 2.247 1.349 1.637 1.278 2.142 3.234 1.920 1.973 0.972 16.067 3.221 1.383 1.533 1.887 196 | 1.703 1.609 1.403 1.030 1.325 1.573 2.771 2.214 2.848 1.041 4.029 1.974 1.353 2.552 1.859 197 | 2.722 2.132 0.874 0.724 1.514 2.226 2.588 2.817 3.332 1.535 11.017 1.921 1.666 2.693 1.641 198 | 1.951 1.937 2.536 0.577 1.547 1.183 2.038 2.395 2.576 1.669 12.915 2.339 2.168 3.063 1.741 199 | 1.658 2.074 1.685 0.530 2.111 2.621 3.351 2.894 2.974 1.777 5.345 1.717 2.168 2.368 1.801 200 | 1.555 1.580 1.045 0.222 2.196 3.095 3.037 2.371 3.021 1.617 4.760 1.794 1.257 2.354 1.579 201 | 0.504 1.274 1.526 0.959 1.771 1.698 2.777 3.861 4.091 0.754 10.744 1.318 1.517 2.004 1.606 202 | 1.199 1.216 1.432 0.242 1.541 0.776 2.313 2.194 2.867 1.803 12.466 1.053 1.854 2.370 0.644 203 | 1.179 1.127 1.666 0.395 2.049 1.323 3.274 2.720 2.963 1.695 6.944 1.128 1.800 2.273 0.246 204 | 1.300 2.011 0.788 0.240 1.746 2.502 3.362 3.356 3.164 1.936 4.933 2.057 1.334 1.748 1.704 205 | 2.127 2.350 1.248 1.385 1.678 2.120 4.016 3.524 3.215 1.723 10.113 2.312 1.398 2.791 1.484 206 | 0.948 1.602 0.647 0.791 1.644 2.867 4.101 4.043 3.433 0.743 54.397 30.976 1.731 2.179 1.791 207 | 1.071 1.776 1.484 1.075 1.567 2.901 4.606 7.386 3.383 1.162 34.629 10.429 1.831 2.530 1.717 208 | 1.419 2.184 0.994 0.268 1.946 2.283 3.693 3.911 2.391 1.760 11.293 1.957 1.903 2.886 1.766 209 | 1.383 1.740 1.485 0.359 1.579 1.758 2.972 2.801 2.581 0.575 9.205 1.915 0.682 2.708 1.533 210 | 1.050 1.895 1.584 0.895 1.673 2.315 3.025 2.890 3.243 0.887 11.830 2.088 1.511 2.915 1.135 211 | 1.038 0.983 1.053 0.044 1.714 0.733 2.479 2.713 3.292 1.854 5.958 1.218 1.526 2.753 1.098 212 | 0.895 0.227 0.731 0.549 0.402 2.182 2.956 3.242 2.665 0.830 8.005 0.957 1.700 1.634 1.944 213 | 1.374 0.855 1.242 0.109 2.077 2.163 1.775 2.922 2.929 1.045 9.282 0.887 1.823 1.911 0.779 214 | 1.331 1.040 1.379 1.028 2.024 3.001 1.584 3.254 3.493 0.645 15.167 2.402 1.594 2.026 1.550 215 | 1.508 2.162 1.319 1.046 1.750 1.760 2.155 3.573 3.485 1.907 34.538 5.053 1.508 2.052 1.812 216 | 1.324 0.725 1.449 0.435 0.966 1.040 3.033 5.515 2.708 1.054 6.541 1.649 1.482 1.200 1.231 217 | 1.157 0.792 0.570 0.118 1.235 1.320 1.687 1.655 2.777 0.965 7.939 2.454 1.394 2.501 1.086 218 | 1.342 0.787 0.491 0.443 1.000 2.067 3.293 3.141 2.176 0.376 4.828 1.776 0.627 2.446 0.906 219 | 1.385 0.843 0.538 0.373 1.131 1.015 1.860 0.767 1.854 0.765 20.115 3.404 0.833 1.472 0.860 220 | 1.417 0.710 1.616 0.147 1.073 1.837 2.446 2.201 2.240 1.751 12.913 2.318 1.610 1.489 0.610 221 | 1.578 0.879 1.335 0.319 1.145 2.406 3.099 2.135 2.862 1.754 6.067 1.858 1.682 1.569 1.130 222 | 1.320 0.804 1.587 0.204 0.633 0.466 3.168 2.246 2.885 0.943 24.371 3.449 1.809 3.964 0.438 223 | 0.555 0.513 0.649 0.905 1.000 0.622 1.570 0.783 0.900 1.053 12.043 1.953 0.448 1.001 0.854 224 | 1.164 0.119 1.073 0.487 0.808 0.176 2.840 2.640 2.204 1.656 13.828 1.408 0.606 2.141 1.246 225 | 0.280 0.605 0.747 1.291 0.352 0.685 3.058 2.307 1.946 0.833 11.467 2.621 1.668 1.488 0.433 226 | 0.308 0.567 0.747 1.191 1.008 1.719 2.357 2.679 2.192 0.862 8.053 1.934 1.187 1.757 0.661 227 | 0.291 0.916 0.860 1.857 0.806 1.576 1.970 3.654 1.758 1.134 9.133 2.368 0.851 1.401 0.745 228 | 1.068 1.097 0.699 1.239 0.925 1.108 1.677 2.091 1.954 0.826 12.507 2.456 0.798 2.404 0.986 229 | 1.141 0.678 0.727 1.359 0.831 1.298 3.457 4.568 2.356 1.117 14.610 2.633 0.778 1.314 0.513 230 | 0.601 0.683 0.416 1.243 0.970 1.455 2.824 4.627 1.602 1.300 11.337 2.524 0.860 2.662 1.144 231 | 0.402 0.868 0.469 1.393 1.046 0.781 2.204 1.988 2.844 2.219 4.389 1.851 1.026 1.973 0.585 232 | 0.231 1.167 0.488 1.162 0.928 0.612 1.375 1.603 2.352 0.827 21.234 2.999 0.810 2.211 0.792 233 | 1.252 1.581 0.721 1.177 1.125 2.053 1.551 1.632 1.916 0.807 7.348 1.805 0.974 2.000 0.648 234 | 1.019 1.302 0.523 1.028 1.325 1.824 2.597 2.227 2.853 0.833 21.522 3.161 0.594 1.816 0.682 235 | 0.959 0.378 0.900 0.274 0.824 1.396 3.082 1.812 2.130 2.095 21.943 2.598 0.300 0.676 1.349 236 | 1.451 1.215 0.915 1.508 0.936 0.734 2.160 1.092 1.865 0.837 7.505 2.005 0.919 2.091 0.525 237 | 1.273 0.699 0.557 1.051 1.287 1.026 1.287 1.642 1.378 0.749 16.081 3.232 1.037 1.940 0.899 238 | 1.362 0.875 0.282 1.506 1.226 2.224 2.803 1.810 2.482 0.802 33.542 7.237 1.468 1.888 0.450 239 | 0.931 1.129 0.494 1.647 1.911 0.600 1.747 2.225 2.406 1.826 10.047 2.315 0.875 1.601 1.054 240 | 1.463 1.389 0.779 1.657 1.867 0.425 1.161 1.434 1.783 2.173 30.740 4.618 0.458 1.583 0.911 241 | 1.463 1.160 0.706 0.926 1.050 1.084 1.949 1.546 1.533 0.943 6.440 1.735 0.717 1.690 1.207 242 | 1.125 1.066 0.324 0.898 1.003 1.440 1.353 1.885 2.026 0.759 6.431 2.285 0.563 0.890 0.914 243 | 1.512 1.075 0.738 0.799 0.935 1.376 1.783 2.697 1.840 1.027 6.109 1.965 0.648 1.983 0.773 244 | 1.846 0.886 0.328 1.303 1.028 0.432 3.528 1.147 2.183 1.371 15.330 3.037 1.485 1.230 0.565 245 | 1.930 1.500 0.444 0.990 1.023 1.017 2.634 1.409 2.470 0.799 7.141 2.002 2.037 1.305 0.063 246 | 1.328 1.003 0.599 0.443 0.581 2.108 2.690 3.731 2.282 1.775 14.052 1.584 0.436 1.094 0.551 247 | 1.668 1.199 1.137 0.528 1.129 2.935 2.354 1.290 2.212 1.049 21.379 3.108 1.365 1.789 1.137 248 | 1.388 1.087 0.927 1.124 1.025 2.079 4.019 2.781 3.041 0.891 35.538 5.229 1.156 2.484 0.249 249 | 1.938 1.282 1.200 0.161 0.973 2.814 3.203 11.884 2.501 0.146 4.864 2.152 1.635 2.253 0.742 250 | 1.757 2.117 1.098 0.301 0.920 2.041 3.294 2.643 3.565 1.049 29.646 4.587 1.949 2.603 2.183 251 | 1.904 0.929 1.303 0.463 1.227 2.781 2.747 3.006 3.061 1.185 18.558 3.424 1.919 2.402 0.924 252 | 1.705 1.108 1.409 0.055 1.398 1.452 3.652 6.903 3.009 0.565 32.273 4.871 1.881 2.440 1.429 253 | 1.982 1.501 1.457 0.447 1.407 1.289 2.342 2.909 2.433 0.201 5.842 1.693 1.824 1.642 1.194 254 | 1.736 1.219 0.677 0.740 1.063 1.365 2.737 3.176 2.227 0.735 4.710 2.334 2.113 1.602 0.931 255 | 1.803 1.065 1.546 0.360 1.173 0.916 2.103 2.796 1.876 0.396 11.662 1.788 0.179 1.724 1.310 256 | 1.667 1.933 1.190 0.904 1.260 2.162 3.371 3.514 2.777 1.005 8.185 1.957 1.850 2.780 1.465 257 | 1.044 1.750 1.684 1.693 0.721 1.130 2.793 3.033 3.527 1.372 18.876 1.888 1.397 1.732 0.938 258 | 1.671 1.974 1.600 0.151 2.000 1.096 2.777 3.555 3.231 0.756 4.343 1.980 1.750 2.811 2.152 259 | 1.798 0.663 1.183 1.282 1.811 0.402 3.280 21.923 3.358 1.040 5.838 2.299 0.753 2.469 2.368 260 | 0.645 0.878 0.119 0.606 1.698 1.380 3.726 5.397 2.735 0.851 2.752 2.339 1.012 1.584 1.364 261 | 1.262 0.876 0.857 0.122 1.240 1.315 3.224 5.286 2.071 0.538 5.898 1.426 0.382 1.224 3.116 262 | 1.548 1.048 1.031 0.461 1.460 1.671 8.133 13.365 1.434 0.675 13.686 2.560 0.726 1.763 2.542 263 | 1.717 0.620 1.086 1.151 1.642 1.613 4.040 10.208 2.131 1.759 3.519 1.334 0.766 1.181 1.858 264 | 1.019 0.805 0.311 1.068 1.479 0.090 4.002 4.141 3.266 1.762 29.578 5.176 0.662 2.095 2.219 265 | 0.284 1.282 1.660 0.917 1.731 0.604 4.449 4.616 1.858 0.085 14.638 2.916 2.743 1.054 2.793 266 | 0.332 0.981 1.307 2.198 1.628 0.594 4.024 5.186 1.283 0.133 1.524 2.477 1.082 2.045 3.134 267 | 0.653 0.425 1.106 0.220 1.837 0.411 3.029 3.737 1.230 0.290 5.466 1.875 2.298 2.139 2.306 268 | 0.276 1.271 1.676 1.274 1.806 1.630 3.092 2.214 2.509 1.871 16.151 1.973 1.424 2.445 1.645 269 | 0.831 0.784 0.675 0.568 1.433 0.545 3.062 3.867 1.921 0.211 5.856 2.447 0.837 0.912 1.972 270 | 1.755 0.627 0.874 0.716 2.828 1.292 3.274 3.725 1.913 0.235 5.427 1.399 0.144 1.267 1.479 271 | 1.447 1.485 0.562 0.979 1.085 1.339 3.417 3.684 3.145 0.405 6.512 1.544 0.106 2.615 2.382 272 | 1.197 1.665 0.841 1.840 1.976 2.182 3.274 3.312 2.562 0.441 3.613 1.190 0.998 1.617 2.010 273 | 2.508 2.148 0.446 1.559 1.636 2.350 5.056 4.611 2.786 0.521 6.775 1.945 0.820 3.228 2.126 274 | 2.165 2.314 1.837 1.679 1.172 2.093 5.809 4.410 2.846 0.210 3.604 2.338 1.370 2.798 1.568 275 | 2.963 1.855 0.831 1.767 1.621 2.229 4.988 4.707 2.897 0.900 15.401 2.684 2.074 2.663 1.280 276 | 2.092 2.063 0.657 1.701 1.722 2.455 5.220 4.510 3.279 0.694 15.583 2.684 1.591 2.788 1.736 277 | 2.378 2.288 1.076 1.635 1.336 2.967 4.049 5.249 3.516 0.220 10.943 2.421 2.165 2.799 1.426 278 | 1.747 1.067 0.115 2.432 0.876 1.652 3.883 3.619 3.387 0.261 13.185 2.520 2.520 2.259 0.988 279 | 0.555 1.253 2.226 1.234 1.533 1.693 2.416 2.371 2.564 0.817 12.252 1.585 1.389 2.303 1.273 280 | 0.567 1.426 0.063 1.518 0.621 0.830 2.455 3.444 2.198 0.800 4.092 2.592 1.204 1.585 1.217 281 | 0.496 1.165 0.541 1.326 1.029 1.285 3.820 3.612 2.168 0.815 2.920 1.933 0.678 1.191 0.856 282 | 0.587 1.420 0.106 2.134 0.920 0.998 4.213 4.305 1.793 0.423 16.074 2.578 0.577 1.690 1.671 283 | 0.357 1.218 0.432 0.955 1.208 0.966 4.160 2.801 1.969 0.231 6.350 1.645 0.512 1.320 0.939 284 | 1.409 1.280 0.665 2.096 0.998 0.905 2.516 5.603 1.895 0.157 8.037 2.324 0.459 1.572 1.444 285 | 1.416 2.776 1.276 2.715 1.801 1.460 6.042 4.940 2.634 0.536 7.186 2.089 1.346 1.880 2.540 286 | 1.341 2.041 1.479 2.211 1.012 1.861 5.037 3.482 3.698 0.897 6.306 1.760 2.319 2.580 1.512 287 | 1.471 1.093 1.177 1.348 1.624 1.102 6.067 4.078 3.164 0.324 9.141 2.138 2.183 1.935 1.199 288 | 1.235 1.058 0.975 1.784 1.142 2.177 5.528 4.272 2.137 0.738 6.475 1.843 2.240 2.852 1.073 289 | 1.192 0.994 1.258 1.777 1.439 0.092 4.828 2.855 3.325 0.658 5.794 1.735 2.232 2.653 1.143 290 | 0.565 0.909 1.880 0.915 1.207 0.905 2.382 2.261 2.687 1.050 22.916 2.533 1.184 2.489 1.655 291 | 1.357 1.203 1.003 2.177 1.127 0.499 4.135 3.850 3.128 0.169 3.755 1.439 1.842 2.526 0.932 292 | 0.844 0.901 0.483 1.947 0.982 0.924 3.388 3.528 2.141 0.321 6.702 1.650 1.875 2.233 1.047 293 | 1.488 1.337 0.268 1.426 1.056 0.506 3.696 3.203 1.960 0.445 8.702 2.246 1.432 1.593 1.557 294 | 1.353 0.618 0.362 1.303 1.214 0.589 3.630 3.771 2.340 0.388 7.460 2.126 1.070 0.759 1.380 295 | 1.238 1.183 0.289 1.798 0.925 1.257 3.742 4.459 2.323 0.591 17.736 2.674 1.156 1.723 1.909 296 | 0.903 0.594 0.967 1.835 1.003 1.081 4.643 7.266 2.075 0.188 5.403 1.617 1.719 1.935 0.517 297 | 0.833 2.053 1.494 0.263 1.769 1.751 4.083 4.270 2.794 0.712 9.419 2.145 2.227 2.904 1.886 298 | 0.876 2.170 1.463 0.568 1.293 2.380 3.823 3.531 3.389 0.554 22.758 3.554 2.073 2.475 2.401 299 | 1.385 1.000 0.206 0.637 0.898 0.485 3.297 4.731 3.224 1.000 10.244 1.999 1.352 2.349 0.949 300 | 1.439 1.397 0.467 0.489 1.058 1.342 2.958 3.353 1.939 1.102 4.565 2.454 0.435 1.644 1.247 301 | 0.737 1.153 0.964 0.602 0.675 1.240 2.467 1.648 2.479 0.703 9.190 1.096 1.238 1.628 0.855 302 | 0.583 1.297 0.166 0.576 0.936 0.411 2.581 2.676 2.661 1.209 3.873 1.227 0.414 1.491 1.396 303 | 1.372 2.148 1.375 1.105 1.933 1.877 4.286 2.084 2.206 0.760 9.542 0.999 0.918 1.510 2.206 304 | 1.030 2.138 1.140 1.448 1.558 2.161 2.225 2.528 2.786 0.539 8.718 2.301 1.494 2.411 1.910 305 | 2.536 2.133 1.168 1.236 1.667 2.055 2.188 2.089 2.852 0.959 4.550 1.985 1.310 2.511 1.741 306 | 1.573 1.852 1.156 1.503 2.218 1.112 1.025 1.796 2.680 1.017 18.050 2.696 1.307 2.838 2.195 307 | 1.213 1.895 0.607 0.271 0.823 1.048 1.355 1.238 3.203 0.948 11.632 2.551 2.013 2.863 2.022 308 | 1.655 2.307 1.058 0.326 1.550 0.366 0.675 0.832 2.544 0.547 7.318 1.745 1.822 2.133 1.498 309 | 1.179 2.115 1.113 0.213 1.019 1.680 0.850 1.633 2.235 0.523 6.681 2.029 1.926 2.980 1.593 310 | 1.387 2.135 0.937 0.427 1.348 2.173 2.819 1.582 4.248 0.921 7.523 2.029 1.666 2.309 1.278 311 | 0.748 0.830 0.478 1.109 1.064 1.709 2.918 1.204 3.267 0.862 6.312 1.545 1.270 2.526 1.063 312 | 1.478 1.175 1.769 0.862 1.222 1.244 1.577 2.118 2.617 1.345 22.249 2.545 1.541 1.439 1.102 313 | 0.937 0.939 0.541 1.146 1.018 1.333 0.360 1.150 0.706 0.532 7.089 1.061 0.861 1.400 1.115 314 | 0.484 1.037 0.454 0.751 1.375 1.176 0.688 0.721 0.950 0.681 2.639 1.276 0.582 0.588 1.676 315 | 0.590 0.915 0.424 0.936 0.454 1.202 0.147 0.426 1.730 0.879 17.551 2.834 0.270 0.405 1.032 316 | 1.413 1.560 0.357 0.996 1.034 1.262 0.386 0.699 2.468 0.533 4.684 1.892 0.430 1.367 1.081 317 | 1.700 1.730 0.585 0.897 1.367 1.570 2.063 1.841 1.871 1.297 8.693 1.768 1.048 1.395 1.356 318 | 0.341 1.241 0.154 1.068 0.886 0.898 3.936 1.972 1.983 0.698 16.775 2.549 0.559 1.299 1.293 319 | 1.629 1.178 0.812 0.058 1.022 0.860 0.469 0.693 1.501 1.034 8.022 2.115 0.087 1.272 1.344 320 | 1.036 0.963 0.660 0.349 1.661 0.813 0.250 0.753 2.814 0.811 4.734 1.601 1.085 1.237 2.239 321 | 1.322 2.118 1.365 1.441 1.661 0.835 1.427 0.515 3.127 0.781 6.895 1.909 1.150 1.492 1.820 322 | -------------------------------------------------------------------------------- /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/header.png -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import pickle 4 | import sys 5 | from multiprocessing import Process, Queue 6 | from multiprocessing.pool import ThreadPool 7 | 8 | import cv2 9 | import numpy as np 10 | from sklearn.cluster import MiniBatchKMeans 11 | from sklearn.tree import DecisionTreeRegressor 12 | 13 | # Train-test ratio 14 | TRAIN_RATIO = 0.8 15 | SMALL_DATA_SIZE = 5000 16 | 17 | # Dimension of each feature vector 18 | NUM_FEATS = 500 19 | MAX_FEAT_OFFSET = 150 20 | 21 | # Number of samples for each joint for each example 22 | NUM_SAMPLES = 300 23 | 24 | # Set maximum XYZ offset from each joint 25 | MAX_XY_OFFSET = 10 # image xy coordinates (pixels) 26 | MAX_Z_OFFSET = 0.5 # z-depth coordinates (meters) 27 | 28 | # Number of clusters for K-Means regression 29 | K = 20 30 | 31 | # Depth image dimension 32 | IMAGE_HEIGHT, IMAGE_WITCH = 240, 320 33 | # H, W = 424, 512 34 | 35 | # See https://help.autodesk.com/view/MOBPRO/2018/ENU/?guid=__cpp_ref__nui_image_camera_8h_source_html 36 | C = 3.8605e-3 # NUI_CAMERA_DEPTH_NOMINAL_INVERSE_FOCAL_LENGTH_IN_PIXELS 37 | 38 | ############################################################################### 39 | # RTW Constants 40 | ############################################################################### 41 | 42 | # Number of joints in a skeleton 43 | NUM_JOINTS = 15 44 | 45 | # List of joint names 46 | JOINT_NAMES = ['NECK (0)', 'HEAD (1)', 47 | 'LEFT SHOULDER (2)', 'LEFT ELBOW (3)', 'LEFT HAND (4)', 48 | 'RIGHT SHOULDER (5)', 'RIGHT ELBOW (6)', 'RIGHT HAND (7)', 49 | 'LEFT KNEE (8)', 'LEFT FOOT (9)', 50 | 'RIGHT KNEE (10)', 'RIGHT FOOT (11)', 51 | 'LEFT HIP (12)', 52 | 'RIGHT HIP (13)', 53 | 'TORSO (14)'] 54 | 55 | # Map from joint names to index 56 | JOINT_IDX = { 57 | 'NECK': 0, 58 | 'HEAD': 1, 59 | 'LEFT SHOULDER': 2, 60 | 'LEFT ELBOW': 3, 61 | 'LEFT HAND': 4, 62 | 'RIGHT SHOULDER': 5, 63 | 'RIGHT ELBOW': 6, 64 | 'RIGHT HAND': 7, 65 | 'LEFT KNEE': 8, 66 | 'LEFT FOOT': 9, 67 | 'RIGHT KNEE': 10, 68 | 'RIGHT FOOT': 11, 69 | 'LEFT HIP': 12, 70 | 'RIGHT HIP': 13, 71 | 'TORSO': 14, 72 | } 73 | 74 | # Set the kinematic tree (starting from torso body center) 75 | kinem_order = [14, 0, 13, 12, 1, 2, 5, 3, 6, 4, 7, 8, 10, 9, 11] 76 | kinem_parent = [-1, 14, 14, 14, 0, 0, 0, 2, 5, 3, 6, 12, 13, 8, 10] 77 | 78 | # Number of steps during evaluation 79 | NUM_STEPS = 300 80 | 81 | # Step size (in cm) during evaluation 82 | STEP_SIZE = 2 83 | 84 | np.set_printoptions(threshold=np.nan) 85 | 86 | 87 | palette = [(34, 88, 226), (34, 69, 101), (0, 195, 243), (146, 86, 135), 88 | (38, 61, 43), (241, 202, 161), (50, 0, 190), (128, 178, 194), 89 | (23, 45, 136), (0, 211, 220), (172, 143, 230), (108, 68, 179), 90 | (121, 147, 249), (151, 78, 96), (0, 166, 246), (165, 103, 0), 91 | (86, 136, 0), (130, 132, 132), (0, 182, 141), (0, 132, 243)] # BGR 92 | 93 | jointNameEVAL = ['NECK', 'HEAD', 'LEFT SHOULDER', 'LEFT ELBOW', 94 | 'LEFT HAND', 'RIGHT SHOULDER', 'RIGHT ELBOW', 'RIGHT HAND', 95 | 'LEFT KNEE', 'LEFT FOOT', 'RIGHT KNEE', 'RIGHT FOOT', 96 | 'LEFT HIP', 'RIGHT HIP', 'TORSO'] 97 | jointNameITOP = ['HEAD', 'NECK', 'LEFT_SHOULDER', 'RIGHT_SHOULDER', 98 | 'LEFT_ELBOW', 'RIGHT_ELBOW', 'LEFT_HAND', 'RIGHT_HAND', 99 | 'TORSO', 'LEFT_HIP', 'RIGHT_HIP', 'LEFT_KNEE', 100 | 'RIGHT_KNEE', 'LEFT_FOOT', 'RIGHT_FOOT'] 101 | 102 | trainTestITOP = [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0] # train = 0, test = 1 103 | kinemOrderEVAL = [0, 1, 2, 5, 3, 6, 4, 7, 8, 10, 9, 11] 104 | kinemParentEVAL = [-1, 0, 0, 0, 2, 5, 3, 6, -1, -1, 8, 10] 105 | kinemOrderITOP = [8, 1, 0, 9, 10, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14] 106 | kinemOrderITOPUpper = [8, 1, 0, 2, 3, 4, 5, 6, 7] 107 | kinemParentITOP = [-1, 8, 1, 8, 8, 1, 1, 2, 3, 4, 5, 9, 10, 11, 12] 108 | 109 | 110 | def load_dataset(processed_dir, is_mask=False, small_data=False): 111 | """Loads the depth images and joints from the processed dataset. 112 | 113 | Note that each joint is a coordinate of the form (im_x, im_y, depth_z). 114 | Each depth image is an H x W image containing depth_z values. 115 | 116 | depth_z values are in meters. 117 | 118 | @return: 119 | depth_images : depth images (N x H x W) 120 | joints : joint positions (N x NUM_JOINTS x 3) 121 | """ 122 | print('Loading data from directory %s' % processed_dir) 123 | 124 | # Load input and labels from numpy files 125 | # N x H x W depth images 126 | depth_images = np.load(os.path.join(processed_dir, 'depth_images.npy')) 127 | joints = np.load(os.path.join(processed_dir, 'joints.npy') 128 | ) # N x NUM_JOINTS x 3 joint locations 129 | 130 | assert depth_images.shape[1] == IMAGE_HEIGHT and depth_images.shape[2] == IMAGE_WITCH, "Invalid dimensions for depth image" 131 | 132 | # Load and apply mask to the depth images 133 | if is_mask: 134 | # N x H x W depth mask 135 | depth_mask = np.load(os.path.join(processed_dir, 'depth_mask.npy')) 136 | depth_images = depth_images * depth_mask 137 | 138 | # Run experiments on random subset of data 139 | if small_data: 140 | random_idx = np.random.choice( 141 | depth_images.shape[0], SMALL_DATA_SIZE, replace=False) 142 | depth_images, joints = depth_images[random_idx], joints[random_idx] 143 | 144 | print('Data loaded: # data: %d' % depth_images.shape[0]) 145 | return depth_images, joints 146 | 147 | 148 | def split_dataset(X, y, train_ratio): 149 | """Splits the dataset according to the train-test ratio. 150 | 151 | @params: 152 | X : depth images (N x H x W) 153 | y : joint positions (N x NUM_JOINTS x 3) 154 | train_ratio : ratio of training to test 155 | """ 156 | test_ratio = 1.0 - train_ratio 157 | num_test = int(X.shape[0] * test_ratio) 158 | 159 | X_train, y_train = X[num_test:], y[num_test:] 160 | X_test, y_test = X[:num_test], y[:num_test] 161 | 162 | print('Data split: # training data: %d, # test data: %d' % 163 | (X_train.shape[0], X_test.shape[0])) 164 | return X_train, y_train, X_test, y_test 165 | 166 | 167 | def get_features_by_time(img_seq, joint_time_seq, z, theta): 168 | """Gets the feature vector for a single example. 169 | 170 | @params: 171 | img : depth image sequence. shape=(T x H x W) 172 | joint_time_seq : 关节点的时间序列 shape=(T x 3) 173 | z : z-value of body center shape=(T) 174 | theta : (-max_feat_offset, max_feat_offset) = (T, 4, num_feats) 175 | """ 176 | 177 | joint_time_seq[:, 1] = np.clip( # limits y between 0 and H 178 | joint_time_seq[:, 1], 0, IMAGE_HEIGHT - 1) 179 | 180 | joint_time_seq[:, 0] = np.clip( # limits x between 0 and W 181 | joint_time_seq[:, 0], 0, IMAGE_WITCH - 1) 182 | coor = np.rint(joint_time_seq[:, :2]) # rounds to nearest integer 183 | coor = coor[:, ::-1].astype(int) # 按列逆序, x, y -> y, x 184 | 185 | # Find z-value of joint offset by indexing into depth imag 186 | LARGE_NUM = 100 # initialize to LARGE_NUM 187 | img_seq[img_seq == 0] = LARGE_NUM # no division by zero 188 | 189 | # Extracted depth time sequence from images 190 | depth_seq = img_seq[np.arange(img_seq.shape[0]), coor[:, 0], coor[:, 1]] 191 | flag = depth_seq == LARGE_NUM # If depth equals to LARGE_NUM 192 | depth_seq[flag] = z[flag] # depth is z 193 | 194 | # Normalize x theta by z-value 195 | x1 = np.clip(coor[:, 1, None] + theta[0] / 196 | depth_seq[:, None], 0, IMAGE_WITCH - 1).astype(int) 197 | x2 = np.clip(coor[:, 1, None] + theta[2] / 198 | depth_seq[:, None], 0, IMAGE_WITCH - 1).astype(int) 199 | 200 | # Normalize y theta by z-value 201 | y1 = np.clip(coor[:, 0, None] + theta[1] / 202 | depth_seq[:, None], 0, IMAGE_HEIGHT - 1).astype(int) 203 | y2 = np.clip(coor[:, 0, None] + theta[3] / 204 | depth_seq[:, None], 0, IMAGE_HEIGHT - 1).astype(int) 205 | 206 | # Feature matrix. shape=(1608, 500) 列向量是每张图片的特征矩阵 207 | feature = np.array([img_seq[t, y1[t, :], x1[t, :]] - 208 | img_seq[t, y2[t, :], x2[t, :]] for t in range(img_seq.shape[0])]) 209 | return feature 210 | 211 | 212 | def get_features(img, q, z, theta): 213 | """Gets the feature vector for a single example. 214 | 215 | @params: 216 | img : depth image = (H x W) 217 | q : joint xyz position with some random offset vector 218 | z : z-value of body center 219 | theta : (-max_feat_offset, max_feat_offset) = (4, num_feats) 220 | """ 221 | # Retrieve the (y, x) of the joint offset coordinates 222 | coor = q[:2][::-1] # coor: flip x, y -> y, x 223 | coor[0] = np.clip(coor[0], 0, IMAGE_HEIGHT - 1) # limits y between 0 and H 224 | coor[1] = np.clip(coor[1], 0, IMAGE_WITCH - 1) # limits x between 0 and W 225 | coor = np.rint(coor).astype(int) # rounds to nearest integer 226 | 227 | # Find z-value of joint offset by indexing into depth imag 228 | LARGE_NUM = 100 229 | img[img == 0] = LARGE_NUM # no division by zero 230 | # initialize to LARGE_NUM 231 | dq = z if (img[tuple(coor)] == LARGE_NUM) else img[tuple(coor)] 232 | 233 | # Normalize x theta by z-value 234 | x1 = np.clip(coor[1] + theta[0] / dq, 0, IMAGE_WITCH - 1).astype(int) 235 | x2 = np.clip(coor[1] + theta[2] / dq, 0, IMAGE_WITCH - 1).astype(int) 236 | 237 | # Normalize y theta by z-value 238 | y1 = np.clip(coor[0] + theta[1] / dq, 0, IMAGE_HEIGHT - 1).astype(int) 239 | y2 = np.clip(coor[0] + theta[3] / dq, 0, IMAGE_HEIGHT - 1).astype(int) 240 | 241 | # Get the feature vector as difference of depth-values 242 | feature = img[y1, x1] - img[y2, x2] 243 | return feature 244 | 245 | 246 | def get_random_offset(max_offset_xy=MAX_XY_OFFSET, max_offset_z=MAX_Z_OFFSET): 247 | """Gets xyz vector with uniformly random xy and z offsets. 248 | """ 249 | offset_xy = np.random.randint(-max_offset_xy, max_offset_xy + 1, 2) 250 | offset_z = np.random.uniform(-max_offset_z, max_offset_z, 1) 251 | offset = np.concatenate((offset_xy, offset_z)) # xyz offset 252 | return offset 253 | 254 | 255 | def extract_feat_by_time(joint_id, imgs, joints, theta, num_feats=NUM_FEATS): 256 | """Generates training samples for each joint by time sequence. 257 | 258 | Each sample is (i, q, u, f) where: 259 | i is the index of the depth image, 260 | q is the random offset point from the joint, 261 | u is the unit direction vector toward the joint location, 262 | f is the feature array 263 | 264 | @params: 265 | imgs : depth images (T x H x W) 266 | joints : joint position = (T x NUM_JOINTS x 3) = (im_x, im_y, depth_z) 267 | joint_id : current joint id 268 | num_samples : number of samples of each joint 269 | max_offset_xy : maximum offset for samples in (x, y) axes 270 | max_offset_z : maximum offset for samples in z axis 271 | 272 | @return: 273 | feature : samples feature array (T x num_samples x num_feats) 274 | unit : samples unit direction vectors (T x num_samples x 3) 275 | """ 276 | feature = np.zeros((imgs.shape[0], NUM_SAMPLES, num_feats)) 277 | unit = np.zeros((imgs.shape[0], NUM_SAMPLES, 3)) 278 | 279 | for sample_id in range(NUM_SAMPLES): # 生成300个采样点 280 | print('Start getting %s sample point %d...' % 281 | (JOINT_NAMES[joint_id], sample_id)) 282 | offset = np.array([np.random.randint(-10, 11, imgs.shape[0]), 283 | np.random.randint(-10, 11, imgs.shape[0]), 284 | np.random.uniform(-0.5, 0.5, imgs.shape[0])]).T 285 | # if np.linalg.norm(offset[i, :]) != 0, 286 | # unit[i, sample_id, :] = np.array([-offset[i, :] / np.linalg.norm(offset[i, :]) 287 | flag = np.linalg.norm(offset, axis=1) != 0 288 | unit[flag, sample_id, :] = -offset[flag, :] / \ 289 | np.linalg.norm(offset[flag], axis=1)[:, None] 290 | 291 | body_center_z = joints[:, JOINT_IDX['TORSO'], 2] 292 | 293 | feature[:, sample_id, :] = get_features_by_time( # 一次采样的特征(T*500) 294 | imgs, joints[:, joint_id] + offset, body_center_z, theta) 295 | 296 | return feature, unit 297 | 298 | 299 | def stochastic(regressor, features, unit_directions): 300 | """Applies stochastic relaxation when choosing the unit direction. Training 301 | samples at the leaf nodes are further clustered using K-means. 302 | """ 303 | L = {} 304 | 305 | indices = regressor.apply(features) # leaf id of each sample 306 | leaf_ids = np.unique(indices) # array of unique leaf ids 307 | 308 | print('Running stochastic (minibatch) K-Means...') 309 | for leaf_id in leaf_ids: 310 | kmeans = MiniBatchKMeans(n_clusters=K, batch_size=1000) 311 | labels = kmeans.fit_predict(unit_directions[indices == leaf_id]) 312 | weights = np.bincount(labels).astype(float) / labels.shape[0] 313 | 314 | # Normalize the centers 315 | centers = kmeans.cluster_centers_ 316 | centers /= np.linalg.norm(centers, axis=1)[:, np.newaxis] 317 | # checkUnitVectors(centers) 318 | 319 | L[leaf_id] = (weights, centers) 320 | return L 321 | 322 | 323 | def train(joint_id, X, y, model_dir, load_models, min_samples_leaf=400): 324 | """Trains a regressor tree on the unit directions towards the joint. 325 | 326 | @params: 327 | joint_id : current joint id 328 | X : samples feature array (N x num_samples x num_feats) 329 | y : samples unit direction vectors (N x num_samples x 3) 330 | min_samples_split : minimum number of samples required to split an internal node 331 | load_models : load trained models from disk (if exist) 332 | """ 333 | print('Start training %s model...' % JOINT_NAMES[joint_id]) 334 | 335 | regressor_path = os.path.join( 336 | model_dir, 'regressor' + str(joint_id) + '.pkl') 337 | L_path = os.path.join(model_dir, 'L' + str(joint_id) + '.pkl') 338 | 339 | # Load saved model from disk 340 | if load_models and (os.path.isfile(regressor_path) and os.path.isfile(L_path)): 341 | print('Loading model %s from files...' % JOINT_NAMES[joint_id]) 342 | 343 | regressor = pickle.load(open(regressor_path, 'rb')) 344 | L = pickle.load(open(L_path, 'rb')) 345 | return regressor, L 346 | 347 | # (N x num_samples, num_feats) 348 | X_reshape = X.reshape(X.shape[0] * X.shape[1], X.shape[2]) 349 | y_reshape = y.reshape(y.shape[0] * y.shape[1], 350 | y.shape[2]) # (N x num_samples, 3) 351 | 352 | # Count the number of valid (non-zero) samples 353 | # inverse of invalid samples 354 | valid_rows = np.logical_not(np.all(X_reshape == 0, axis=1)) 355 | print('Model %s - Valid samples: %d / %d' % 356 | (JOINT_NAMES[joint_id], X_reshape[valid_rows].shape[0], X_reshape.shape[0])) 357 | 358 | # Fit decision tree to samples 359 | regressor = DecisionTreeRegressor(min_samples_leaf=min_samples_leaf) 360 | regressor.fit(X_reshape[valid_rows], y_reshape[valid_rows]) 361 | 362 | L = stochastic(regressor, X_reshape, y_reshape) 363 | 364 | # Print statistics on leafs 365 | leaf_ids = regressor.apply(X_reshape) 366 | bin = np.bincount(leaf_ids) 367 | unique_ids = np.unique(leaf_ids) 368 | biggest = np.argmax(bin) 369 | smallest = np.argmin(bin[bin != 0]) 370 | 371 | print('Model %s - # Leaves: %d' % 372 | (JOINT_NAMES[joint_id], unique_ids.shape[0])) 373 | print('Model %s - Smallest Leaf ID: %d, # Samples: %d/%d' % 374 | (JOINT_NAMES[joint_id], smallest, bin[bin != 0][smallest], np.sum(bin))) 375 | print('Model %s - Biggest Leaf ID: %d, # Samples: %d/%d' % 376 | (JOINT_NAMES[joint_id], biggest, bin[biggest], np.sum(bin))) 377 | print('Model %s - Average Leaf Size: %d' % 378 | (JOINT_NAMES[joint_id], np.sum(bin) / unique_ids.shape[0])) 379 | 380 | # Save models to disk 381 | pickle.dump(regressor, open(regressor_path, 'wb')) 382 | pickle.dump(L, open(L_path, 'wb')) 383 | 384 | return regressor, L 385 | 386 | 387 | def train_series(joint_id, X, y, theta, model_dir, load_model_flag): 388 | """Train each joint sequentially. 389 | """ 390 | feature, unit = extract_feat_by_time(joint_id, X, y, theta) 391 | # feature, unit = extract_feat_by_frame(joint_id, X, y, theta) 392 | regressor, L = train(joint_id, feature, unit, model_dir, load_model_flag) 393 | return regressor, L 394 | 395 | 396 | def predict(regressor, L, theta, qm0, img_seq, body_center, num_steps=NUM_STEPS, step_size=2): 397 | """Test the model on a single example. 398 | """ 399 | num_test_img = img_seq.shape[0] 400 | qm = np.zeros((num_test_img, num_steps + 1, 3)) 401 | qm[:, 0] = qm0 402 | joint_pred = np.zeros((num_test_img, 3)) 403 | 404 | for i in range(num_steps): 405 | body_center_z = body_center[:, 2] 406 | f = get_features_by_time(img_seq, qm[:, i], body_center_z, theta) 407 | # f = f.reshape(1, -1) # flatten feature vector 408 | leaf_id = np.array([regressor.apply(f[t].reshape(1, -1))[0] 409 | for t in range(num_test_img)]) 410 | 411 | idx = np.array([np.random.choice(K, p=L[leaf_id[t]][0]) 412 | for t in range(num_test_img)]) # L[leaf_id][0] = weights 413 | u = np.array([L[leaf_id[t]][1][idx[t]] 414 | for t in range(num_test_img)]) # L[leaf_id][1] = centers 415 | 416 | qm[:, i + 1] = qm[:, i] + u * step_size 417 | # limit x between 0 and W 418 | qm[:, i + 1, 0] = np.clip(qm[:, i + 1, 0], 0, IMAGE_WITCH - 1) 419 | # limit y between 0 and H 420 | qm[:, i + 1, 1] = np.clip(qm[:, i + 1, 1], 0, IMAGE_HEIGHT - 1) 421 | # index (y, x) into image for z position 422 | qm[:, i + 1, 2] = np.array([img_seq[t, int(qm[t, i + 1, 1]), int(qm[t, i + 1, 0])] 423 | for t in range(num_test_img)]) 424 | joint_pred += qm[:, i + 1] 425 | 426 | joint_pred = joint_pred / num_steps 427 | return qm, joint_pred 428 | 429 | 430 | def init_workspace(dir_list): 431 | try: 432 | for path in dir_list: 433 | if not os.path.exists(path): 434 | os.makedirs(path) 435 | except OSError as e: 436 | if e.errno != 17: 437 | raise 438 | pass 439 | 440 | 441 | def drawPred(img, joints, paths, center, filename, nJoints, jointName): 442 | H = img.shape[0] 443 | W = img.shape[1] 444 | 445 | img = (img - np.amin(img)) * 255.0 / (np.amax(img) - np.amin(img)) 446 | img = img.astype(np.uint8) 447 | img = cv2.equalizeHist(img) 448 | img = cv2.cvtColor(img, cv2.COLOR_GRAY2RGB) 449 | img = cv2.applyColorMap(img, cv2.COLORMAP_OCEAN) 450 | img = np.hstack((img, np.zeros((H, 100, 3)))).astype(np.uint8) 451 | 452 | if paths is not None: 453 | paths_copy = paths.copy() 454 | for i, path in enumerate(paths_copy): 455 | nPts = path.shape[0] 456 | for j, pt in enumerate(path): 457 | color = tuple(c * (2 * j + nPts) / (3 * nPts) 458 | for c in palette[i]) 459 | cv2.circle(img, tuple(pt[:2].astype(np.uint16)), 1, color, -1) 460 | 461 | if joints is not None: 462 | joints_copy = joints.copy() 463 | for i, joint in enumerate(joints_copy): 464 | cv2.circle(img, tuple(joint[:2].astype( 465 | np.uint16)), 4, palette[i], -1) 466 | 467 | for i, joint in enumerate(joints): 468 | cv2.rectangle(img, (W, int(H * i / nJoints)), (W + 100, 469 | int(H * (i + 1) / nJoints - 1)), palette[i], -1) 470 | cv2.putText(img, jointName[i], (W, int( 471 | H * (i + 1) / nJoints - 5)), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (255, 255, 255)) 472 | 473 | cv2.rectangle(img, tuple([int(center[0] - 2), int(center[1] - 2)]), 474 | tuple([int(center[0] + 2), int(center[1] + 2)]), 475 | palette[nJoints], -1) 476 | 477 | cv2.imwrite(filename, img) 478 | 479 | 480 | def checkUnitVectors(unitVectors): 481 | s1 = np.sum(unitVectors.astype(np.float32)**2) 482 | s2 = unitVectors.shape[0] 483 | print('error: %0.3f' % (abs(s1 - s2) / s2)) 484 | 485 | 486 | def pixel2world(pixel, C): 487 | world = np.empty(pixel.shape) 488 | world[:, 2] = pixel[:, 2] 489 | world[:, 0] = (pixel[:, 0] - IMAGE_WITCH / 2.0) * C * pixel[:, 2] 490 | world[:, 1] = -(pixel[:, 1] - IMAGE_HEIGHT / 2.0) * C * pixel[:, 2] 491 | return world 492 | 493 | 494 | def world2pixel(world, C): 495 | pixel = np.empty(world.shape) 496 | pixel[:, 2] = world[:, 2] 497 | pixel[:, 0] = (world[:, 0] / world[:, 2] / C + 498 | IMAGE_WITCH / 2.0).astype(int) 499 | pixel[:, 1] = (-world[:, 1] / world[:, 2] / C + 500 | IMAGE_HEIGHT / 2.0).astype(int) 501 | return pixel 502 | 503 | 504 | def get_distances(y_test, y_pred): 505 | """Compute the raw world distances between the prediction and actual joint 506 | locations. 507 | """ 508 | assert y_test.shape == y_pred.shape, "Mismatch of y_test and y_pred" 509 | 510 | distances = np.zeros((y_test.shape[:2])) 511 | for i in range(y_test.shape[0]): 512 | p1 = pixel2world(y_test[i], C) 513 | p2 = pixel2world(y_pred[i], C) 514 | distances[i] = np.sqrt(np.sum((p1 - p2)**2, axis=1)) 515 | return distances 516 | 517 | 518 | if __name__ == "__main__": 519 | parser = argparse.ArgumentParser( 520 | description='Random Tree Walks algorithm.') 521 | parser.add_argument('--load-model', action='store_true', 522 | help='Load a pretrained model') 523 | parser.add_argument('--load-test', action='store_true', 524 | help='Run trained model on test set') 525 | parser.add_argument('--input-dir', type=str, default='data/input', 526 | help='Directory of the processed input') 527 | parser.add_argument('--dataset', type=str, default='NTU-RGBD', # NTU-RGBD, CAD-60 528 | help='Name of the dataset to load') 529 | 530 | # Training options 531 | parser.add_argument('--seed', type=int, default=1111, 532 | help='Random seed') 533 | parser.add_argument('--shuffle', type=int, default=1, 534 | help='Shuffle the data') 535 | 536 | # Evaluation hyperparameters 537 | # parser.add_argument('--num-steps', type=int, default=300, 538 | # help='Number of steps during evaluation') 539 | # parser.add_argument('--step-size', type=int, default=2, 540 | # help='Step size (in cm) during evaluation') 541 | 542 | # Output options 543 | parser.add_argument('--make-png', action='store_true', 544 | help='Draw predictions on top of inputs') 545 | 546 | args = parser.parse_args() 547 | 548 | # Set location of output saved files 549 | args.model_dir = 'model' 550 | args.preds_dir = 'data/output/preds' 551 | args.png_dir = 'data/output/png' 552 | 553 | init_workspace([args.preds_dir, args.png_dir]) 554 | 555 | depth_images, joints = load_dataset(args.input_dir) 556 | imgs_train, joints_train, imgs_test, joints_test = split_dataset( 557 | depth_images, joints, TRAIN_RATIO) 558 | 559 | num_train = imgs_train.shape[0] 560 | num_test = imgs_test.shape[0] 561 | 562 | theta = None 563 | regressors, Ls = {}, {} 564 | 565 | if args.load_model: 566 | print('\n------- Testing models -------') 567 | theta = pickle.load( 568 | open(os.path.join(args.model_dir, 'theta.pkl'), 'rb')) 569 | 570 | for joint_id in range(NUM_JOINTS): 571 | # Load saved model from disk 572 | print('Loading model %s from files...' % JOINT_NAMES[joint_id]) 573 | 574 | regressors[joint_id] = pickle.load( 575 | open(os.path.join(args.model_dir, 'regressor' + str(joint_id) + '.pkl'), 'rb')) 576 | Ls[joint_id] = pickle.load(open(os.path.join(args.model_dir, 577 | 'L' + str(joint_id) + '.pkl'), 'rb')) 578 | else: 579 | print('\n------- Training models -------') 580 | 581 | theta = np.random.randint(low=-MAX_FEAT_OFFSET, 582 | high=MAX_FEAT_OFFSET + 1, 583 | size=(4, NUM_FEATS)) # (4, num_feats) 584 | pickle.dump(theta, open(os.path.join( 585 | args.model_dir, 'theta.pkl'), 'wb')) 586 | 587 | for joint_id in range(NUM_JOINTS): 588 | regressors[joint_id], Ls[joint_id] = train_series( 589 | joint_id, imgs_train, joints_train, theta, args.model_dir, args.load_model) 590 | 591 | print('\n------- Testing models -------') 592 | 593 | qms = np.zeros((num_test, NUM_JOINTS, NUM_STEPS + 1, 3)) 594 | joints_pred = np.zeros((num_test, NUM_JOINTS, 3)) 595 | local_error = np.zeros((num_test, NUM_STEPS + 1, NUM_JOINTS, 3)) 596 | 597 | for i, joint_id in enumerate(kinem_order): 598 | print('Testing %s model', JOINT_NAMES[joint_id]) 599 | parent_joint_id = kinem_parent[i] 600 | 601 | parent_joint = joints_test[:, JOINT_IDX['TORSO']] if parent_joint_id == - \ 602 | 1 else joints_pred[:, parent_joint_id] # 父关节节点的位置 603 | qms[:, joint_id], joints_pred[:, joint_id] = predict( # 当前的关节位置簇和关节位置 604 | regressors[joint_id], Ls[joint_id], theta, parent_joint, imgs_test, joints_test[:, JOINT_IDX['TORSO']]) 605 | local_error[:, :, joint_id, :] = np.tile( 606 | joints_test[:, np.newaxis, joint_id], (1, NUM_STEPS + 1, 1)) - qms[:, joint_id] 607 | 608 | joints_pred[:, :, 2] = joints_test[:, :, 2] 609 | 610 | print('\n------- Computing evaluation metrics -------') 611 | 612 | distances = get_distances(joints_test, joints_pred) * \ 613 | 100.0 # convert from m to cm 614 | 615 | distances_path = os.path.join(args.preds_dir, 'distances.txt') 616 | np.savetxt(distances_path, distances, fmt='%.3f') 617 | 618 | distances_pixel = np.zeros((joints_test.shape[:2])) 619 | for i in range(joints_test.shape[0]): 620 | p1 = joints_test[i] 621 | p2 = joints_pred[i] 622 | distances_pixel[i] = np.sqrt(np.sum((p1 - p2)**2, axis=1)) 623 | 624 | mAP = 0 625 | for i in range(NUM_JOINTS): 626 | print('\nJoint %s:', JOINT_NAMES[i]) 627 | print('Average distance: %f cm' % np.mean(distances[:, i])) 628 | print('Average pixel distance: %f' % 629 | np.mean(distances_pixel[:, i])) 630 | print('5cm accuracy: %f' % (np.sum( 631 | distances[:, i] < 5) / float(distances.shape[0]))) 632 | print('10cm accuracy: %f' % (np.sum( 633 | distances[:, i] < 10) / float(distances.shape[0]))) 634 | print('15cm accuracy: %f' % (np.sum( 635 | distances[:, i] < 15) / float(distances.shape[0]))) 636 | mAP += np.sum(distances[:, i] < 10) / float(distances.shape[0]) 637 | 638 | print('mAP (10cm): %f' % (mAP / NUM_JOINTS)) 639 | 640 | print('\n------- Saving prediction visualizations -------') 641 | 642 | for test_idx in range(num_test): 643 | png_path = os.path.join(args.png_dir, str(test_idx) + '.png') 644 | drawPred(imgs_test[test_idx], joints_pred[test_idx], qms[test_idx], 645 | joints_test[test_idx][JOINT_IDX['TORSO']], png_path, NUM_JOINTS, JOINT_NAMES) 646 | -------------------------------------------------------------------------------- /model/L0.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L0.pkl -------------------------------------------------------------------------------- /model/L1.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L1.pkl -------------------------------------------------------------------------------- /model/L10.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L10.pkl -------------------------------------------------------------------------------- /model/L11.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L11.pkl -------------------------------------------------------------------------------- /model/L12.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L12.pkl -------------------------------------------------------------------------------- /model/L13.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L13.pkl -------------------------------------------------------------------------------- /model/L14.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L14.pkl -------------------------------------------------------------------------------- /model/L2.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L2.pkl -------------------------------------------------------------------------------- /model/L3.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L3.pkl -------------------------------------------------------------------------------- /model/L4.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L4.pkl -------------------------------------------------------------------------------- /model/L5.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L5.pkl -------------------------------------------------------------------------------- /model/L6.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L6.pkl -------------------------------------------------------------------------------- /model/L7.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L7.pkl -------------------------------------------------------------------------------- /model/L8.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L8.pkl -------------------------------------------------------------------------------- /model/L9.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/L9.pkl -------------------------------------------------------------------------------- /model/regressor0.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor0.pkl -------------------------------------------------------------------------------- /model/regressor1.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor1.pkl -------------------------------------------------------------------------------- /model/regressor10.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor10.pkl -------------------------------------------------------------------------------- /model/regressor11.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor11.pkl -------------------------------------------------------------------------------- /model/regressor12.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor12.pkl -------------------------------------------------------------------------------- /model/regressor13.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor13.pkl -------------------------------------------------------------------------------- /model/regressor14.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor14.pkl -------------------------------------------------------------------------------- /model/regressor2.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor2.pkl -------------------------------------------------------------------------------- /model/regressor3.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor3.pkl -------------------------------------------------------------------------------- /model/regressor4.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor4.pkl -------------------------------------------------------------------------------- /model/regressor5.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor5.pkl -------------------------------------------------------------------------------- /model/regressor6.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor6.pkl -------------------------------------------------------------------------------- /model/regressor7.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor7.pkl -------------------------------------------------------------------------------- /model/regressor8.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor8.pkl -------------------------------------------------------------------------------- /model/regressor9.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/regressor9.pkl -------------------------------------------------------------------------------- /model/theta.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mostro-Complexity/depth-pose-estimation/ec6f96d99d81532593195adb4685b25421d3e67f/model/theta.pkl --------------------------------------------------------------------------------