Closed Dayan-Zhanchi closed 4 years ago
The colab tutorial (https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5#scrollTo=kblA1IyFvWbT) is now updated to include inference & evaluation.
Thank you! So I tried running it on my coco-format dataset, following the colab tutorial for inference and evaluation, but it seems that when the number of keypoints is not 17, the evaluation will get a dimension error. As can be seen in the following error message:
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Is there some way to customize this? I'm guessing that the cocoevaluator only has support for persons keypoints, which is 17 keypoints, but I have 294 keypoints in total over all my cloth categories (13 different categories with varying number of keypoints for each category, all summing up to in total 294 keypoints).
I'm not sure if it's related to the OKS settings in cocoapi, but detectron2's config allows you to set OKS for cocoapi.
I haven't looked thoroughly at it, but ye I think you are right. So it's then up to me to define the individual sigma values for the OKS. It seems that for the coco evaluation they use:
sigmas = np.array([.26, .25, .25, .35, .35, .79, .79, .72, .72, .62,.62, 1.07, 1.07, .87, .87, .89, .89])/10.0
, but I obviously will need other values.
EDIT: So I think I found the formula for OKS:
![image](https://user-images.githubusercontent.com/16606436/69000399-69881580-08cf-11ea-8a67-7074ffc9b014.png)
For people working with deepfashion2, the calculated sigma values can be found in the authors repository in the cocoeval.py file: https://github.com/switchablenorms/DeepFashion2/blob/4ba6aae3bbcbf9013fe43f3ce9cc5bfb033639ae/deepfashion2_api/PythonAPI/pycocotools/cocoeval.py#L206
I'll just put it here in case people working with deepfashion2 needs it in the future. NOTE that this is only valid if you are working with deepfashion2 dataset, otherwise you need to calculate the sigma values by yourself, following section 1.3 in http://cocodataset.org/#keypoints-eval.
sigmas = np.array([0.012 , 0.0158, 0.0169, 0.0165, 0.0169, 0.0158, 0.0298, 0.0329, 0.0321, 0.0323, 0.034 , 0.0388, 0.0452, 0.0574, 0.0492, 0.0352, 0.0492, 0.0574, 0.0452, 0.0388, 0.034 , 0.0323, 0.0321, 0.0329, 0.0298, 0.0194, 0.017 , 0.0185, 0.0193, 0.0185, 0.017 , 0.0286, 0.0471, 0.0547, 0.0526, 0.043 , 0.0392, 0.0513, 0.0566, 0.0509, 0.0564, 0.0542, 0.0604, 0.0599, 0.052 , 0.0599, 0.0604, 0.0542, 0.0564, 0.0509, 0.0566, 0.0513, 0.0392, 0.043 , 0.0526, 0.0547, 0.0471, 0.0286, 0.0074, 0.0085, 0.0165, 0.0248, 0.0165, 0.0085, 0.0156, 0.0231, 0.0296, 0.0137, 0.0195, 0.025 , 0.0347, 0.038 , 0.0257, 0.037 , 0.0257, 0.038 , 0.0347, 0.025 , 0.0195, 0.0137, 0.0296, 0.0231, 0.0156, 0.0248, 0.0469, 0.0632, 0.037 , 0.0469, 0.0632, 0.0137, 0.0153, 0.0243, 0.0377, 0.0243, 0.0153, 0.0203, 0.0366, 0.0467, 0.0433, 0.0393, 0.0329, 0.0418, 0.0477, 0.0399, 0.0331, 0.042 , 0.0492, 0.0436, 0.0478, 0.0436, 0.0492, 0.042 , 0.0331, 0.0399, 0.0477, 0.0418, 0.0329, 0.0393, 0.0433, 0.0467, 0.0366, 0.0203, 0.0377, 0.0645, 0.0573, 0.0478, 0.0645, 0.0573, 0.0352, 0.0158, 0.021 , 0.0214, 0.021 , 0.0158, 0.0196, 0.05 , 0.0489, 0.0404, 0.0401, 0.0404, 0.0489, 0.05 , 0.0196, 0.0276, 0.0548, 0.0283, 0.0204, 0.0283, 0.0548, 0.0369, 0.0726, 0.0677, 0.064 , 0.0251, 0.064 , 0.0677, 0.0726, 0.0369, 0.0308, 0.0216, 0.0308, 0.0506, 0.0494, 0.0463, 0.0477, 0.0463, 0.0494, 0.0506, 0.0275, 0.0202, 0.0275, 0.0651, 0.0451, 0.035 , 0.028 , 0.0392, 0.0362, 0.0392, 0.028 , 0.035 , 0.0451, 0.0651, 0.0253, 0.0195, 0.0253, 0.0513, 0.0543, 0.0415, 0.0543, 0.0513, 0.0153, 0.023 , 0.0167, 0.0145, 0.0167, 0.023 , 0.0332, 0.0391, 0.0391, 0.0396, 0.044 , 0.0452, 0.0498, 0.0514, 0.0585, 0.0655, 0.0635, 0.0602, 0.0635, 0.0655, 0.0585, 0.0514, 0.0498, 0.0452, 0.044 , 0.0396, 0.0391, 0.0391, 0.0332, 0.0121, 0.0134, 0.0158, 0.0162, 0.0158, 0.0134, 0.0246, 0.0406, 0.047 , 0.0404, 0.0463, 0.0466, 0.0435, 0.0499, 0.0455, 0.044 , 0.0411, 0.049 , 0.0576, 0.0685, 0.0618, 0.0483, 0.0618, 0.0685, 0.0576, 0.049 , 0.0411, 0.044 , 0.0486, 0.0499, 0.0435, 0.0466, 0.0463, 0.0404, 0.047 , 0.0406, 0.0246, 0.0116, 0.0167, 0.016 , 0.018 , 0.016 , 0.0167, 0.0196, 0.0385, 0.0421, 0.0497, 0.0562, 0.0528, 0.0428, 0.0528, 0.0562, 0.0497, 0.0421, 0.0385, 0.0196, 0.0244, 0.0297, 0.0244, 0.0208, 0.0244, 0.0297, 0.0173, 0.0616, 0.0659, 0.0712, 0.0707, 0.0685, 0.0339, 0.0685, 0.0707, 0.0712, 0.0659, 0.0616, 0.0173])
❓ Questions and Help
So let's say that I have trained a model on keypoints or instance segmentation with datasets that are on coco-format, and used that trained model to get some outputs (Inference) on an unseen data (test data). Now I want to compute the AP with OKS or IOU of that output. Are there any utility functions that can help with this or do we have to add it ourselves? I should say that all my datasets are in coco-format.