Commit ·
fe7cbab
1
Parent(s): 182c3ce
Delete scripts
Browse files
scripts/.ipynb_checkpoints/test-checkpoint.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
# #expid: 1.a
|
| 2 |
-
# python -W ignore::UserWarning tools/test.py --cfg configs/selfattention_noise.yaml \
|
| 3 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 4 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 5 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0,1,2]" \
|
| 6 |
-
# TEST.RESUME 1.a-v1e3_n1e2_012 \
|
| 7 |
-
# TEST.DATASET "unseen" \
|
| 8 |
-
# TEST.MODEL "seen" \
|
| 9 |
-
# TEST.EPOCH 85
|
| 10 |
-
|
| 11 |
-
# #expid: 1.b
|
| 12 |
-
# python -W ignore::UserWarning tools/test.py --cfg configs/selfattention_noise.yaml \
|
| 13 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 14 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 15 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 16 |
-
# TEST.RESUME 1.b-v1e3_n1e2_0 \
|
| 17 |
-
# TEST.DATASET "unseen" \
|
| 18 |
-
# TEST.MODEL "seen" \
|
| 19 |
-
# TEST.EPOCH 63
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
# #expid: 1.c
|
| 23 |
-
# python -W ignore::UserWarning tools/test.py --cfg configs/selfattention_noise.yaml \
|
| 24 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 25 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 26 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[1]" \
|
| 27 |
-
# TEST.RESUME 1.c-v1e3_n1e2_1 \
|
| 28 |
-
# TEST.DATASET "unseen" \
|
| 29 |
-
# TEST.MODEL "seen" \
|
| 30 |
-
# TEST.EPOCH 65
|
| 31 |
-
|
| 32 |
-
#expid: 1.d
|
| 33 |
-
python -W ignore::UserWarning tools/test.py --cfg configs/selfattention_noise.yaml \
|
| 34 |
-
MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 35 |
-
MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 36 |
-
MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[2]" \
|
| 37 |
-
TEST.RESUME 1.d-v1e3_n1e2_2 \
|
| 38 |
-
TEST.DATASET "unseen" \
|
| 39 |
-
TEST.MODEL "seen" \
|
| 40 |
-
TEST.EPOCH 41
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/.ipynb_checkpoints/train-checkpoint.sh
DELETED
|
@@ -1,117 +0,0 @@
|
|
| 1 |
-
# #expid: 0.a
|
| 2 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention.yaml \
|
| 3 |
-
# SESSION 0.a
|
| 4 |
-
|
| 5 |
-
# #expid: 0.b
|
| 6 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention.yaml \
|
| 7 |
-
# SESSION 0.b
|
| 8 |
-
|
| 9 |
-
# #expid: 0.c # change from utils deterministic to original method in coattention
|
| 10 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention.yaml \
|
| 11 |
-
# SESSION 0.c
|
| 12 |
-
|
| 13 |
-
# #expid: 0.d # use deterministic 123 as coattention
|
| 14 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention.yaml \
|
| 15 |
-
# SESSION 0.d
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
# 1 compare adding noise at different layers
|
| 19 |
-
# #expid: 1.a
|
| 20 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 21 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 22 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 23 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0,1,2]" \
|
| 24 |
-
# SESSION 1.a-v1e3_n1e2_012
|
| 25 |
-
|
| 26 |
-
# #expid: 1.b
|
| 27 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 28 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 29 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 30 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 31 |
-
# SESSION 1.b-v1e3_n1e2_0
|
| 32 |
-
|
| 33 |
-
# #expid: 1.c
|
| 34 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 35 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 36 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 37 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[1]" \
|
| 38 |
-
# SESSION 1.c-v1e3_n1e2_1
|
| 39 |
-
|
| 40 |
-
# #expid: 1.d
|
| 41 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 42 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 43 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 44 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[2]" \
|
| 45 |
-
# SESSION 1.d-v1e3_n1e2_2
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
# #expid: 2.a
|
| 49 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 50 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 51 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 52 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 53 |
-
# TRAIN.SAMPLE 1 \
|
| 54 |
-
# SESSION 2.a-v1e3_n1e2_0_0.5
|
| 55 |
-
|
| 56 |
-
# #expid: 3.a
|
| 57 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 58 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-2 \
|
| 59 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 60 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 61 |
-
# SESSION 3.a-v1e2_n1e2_0
|
| 62 |
-
|
| 63 |
-
# #expid: 3.b
|
| 64 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 65 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-4 \
|
| 66 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 67 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 68 |
-
# SESSION 3.b-v1e4_n1e2_0
|
| 69 |
-
|
| 70 |
-
# #expid: 3.c
|
| 71 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 72 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-5 \
|
| 73 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 74 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 75 |
-
# SESSION 3.c-v1e5_n1e2_0
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
# # try different noise type
|
| 79 |
-
# #expid: 4.a
|
| 80 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 81 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 82 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 83 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 84 |
-
# MODEL.SELFATTENTION.NOISE_TYPE "blurry" \
|
| 85 |
-
# SESSION 4.a_v1e3_n1e2_0_blurry
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
# #expid: 4.b # to be run
|
| 89 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 90 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 91 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 92 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 93 |
-
# MODEL.SELFATTENTION.NOISE_TYPE "adaptive" \
|
| 94 |
-
# SESSION 4.b_v1e3_n1e2_0_adaptive
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
# #expid: 5.a
|
| 98 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 99 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 100 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-3 \
|
| 101 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 102 |
-
# SESSION 5.a-v1e3_n1e3_0
|
| 103 |
-
|
| 104 |
-
# #expid: 5.b # zekrom
|
| 105 |
-
# python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 106 |
-
# MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-3 \
|
| 107 |
-
# MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-4 \
|
| 108 |
-
# MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[0]" \
|
| 109 |
-
# SESSION 5.b-v1e3_n1e4_0
|
| 110 |
-
|
| 111 |
-
#expid: 6.a
|
| 112 |
-
python -W ignore::UserWarning tools/train.py --cfg configs/selfattention_noise.yaml \
|
| 113 |
-
MODEL.SELFATTENTION.VERB_BASE_NOISE 1e-4 \
|
| 114 |
-
MODEL.SELFATTENTION.NOUN_BASE_NOISE 1e-2 \
|
| 115 |
-
MODEL.SELFATTENTION.ADD_NOISE_LAYERS "[1]" \
|
| 116 |
-
SESSION 6.a-v1e4_n1e2_1
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/.ipynb_checkpoints/train_i3d_epic.sh
DELETED
|
File without changes
|
scripts/.ipynb_checkpoints/try-checkpoint.ipynb
DELETED
|
@@ -1,154 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": 1,
|
| 6 |
-
"metadata": {},
|
| 7 |
-
"outputs": [],
|
| 8 |
-
"source": [
|
| 9 |
-
"import math\n",
|
| 10 |
-
"import numbers\n",
|
| 11 |
-
"import torch\n",
|
| 12 |
-
"from torch import nn\n",
|
| 13 |
-
"from torch.nn import functional as F\n",
|
| 14 |
-
"\n",
|
| 15 |
-
"class GaussianSmoothing(nn.Module):\n",
|
| 16 |
-
" \"\"\"\n",
|
| 17 |
-
" Apply gaussian smoothing on a\n",
|
| 18 |
-
" 1d, 2d or 3d tensor. Filtering is performed seperately for each channel\n",
|
| 19 |
-
" in the input using a depthwise convolution.\n",
|
| 20 |
-
" Arguments:\n",
|
| 21 |
-
" channels (int, sequence): Number of channels of the input tensors. Output will\n",
|
| 22 |
-
" have this number of channels as well.\n",
|
| 23 |
-
" kernel_size (int, sequence): Size of the gaussian kernel.\n",
|
| 24 |
-
" sigma (float, sequence): Standard deviation of the gaussian kernel.\n",
|
| 25 |
-
" dim (int, optional): The number of dimensions of the data.\n",
|
| 26 |
-
" Default value is 2 (spatial).\n",
|
| 27 |
-
" \"\"\"\n",
|
| 28 |
-
" def __init__(self, channels, kernel_size, sigma, dim=2):\n",
|
| 29 |
-
" super(GaussianSmoothing, self).__init__()\n",
|
| 30 |
-
" if isinstance(kernel_size, numbers.Number):\n",
|
| 31 |
-
" kernel_size = [kernel_size] * dim\n",
|
| 32 |
-
" if isinstance(sigma, numbers.Number):\n",
|
| 33 |
-
" sigma = [sigma] * dim\n",
|
| 34 |
-
"\n",
|
| 35 |
-
" # The gaussian kernel is the product of the\n",
|
| 36 |
-
" # gaussian function of each dimension.\n",
|
| 37 |
-
" kernel = 1\n",
|
| 38 |
-
" meshgrids = torch.meshgrid(\n",
|
| 39 |
-
" [\n",
|
| 40 |
-
" torch.arange(size, dtype=torch.float32)\n",
|
| 41 |
-
" for size in kernel_size\n",
|
| 42 |
-
" ]\n",
|
| 43 |
-
" )\n",
|
| 44 |
-
" for size, std, mgrid in zip(kernel_size, sigma, meshgrids):\n",
|
| 45 |
-
" mean = (size - 1) / 2\n",
|
| 46 |
-
" kernel *= 1 / (std * math.sqrt(2 * math.pi)) * \\\n",
|
| 47 |
-
" torch.exp(-((mgrid - mean) / std) ** 2 / 2)\n",
|
| 48 |
-
"\n",
|
| 49 |
-
" # Make sure sum of values in gaussian kernel equals 1.\n",
|
| 50 |
-
" kernel = kernel / torch.sum(kernel)\n",
|
| 51 |
-
"\n",
|
| 52 |
-
" # Reshape to depthwise convolutional weight\n",
|
| 53 |
-
" kernel = kernel.view(1, 1, *kernel.size())\n",
|
| 54 |
-
" kernel = kernel.repeat(channels, *[1] * (kernel.dim() - 1))\n",
|
| 55 |
-
"\n",
|
| 56 |
-
" self.register_buffer('weight', kernel)\n",
|
| 57 |
-
" self.groups = channels\n",
|
| 58 |
-
"\n",
|
| 59 |
-
" if dim == 1:\n",
|
| 60 |
-
" self.conv = F.conv1d\n",
|
| 61 |
-
" elif dim == 2:\n",
|
| 62 |
-
" self.conv = F.conv2d\n",
|
| 63 |
-
" elif dim == 3:\n",
|
| 64 |
-
" self.conv = F.conv3d\n",
|
| 65 |
-
" else:\n",
|
| 66 |
-
" raise RuntimeError(\n",
|
| 67 |
-
" 'Only 1, 2 and 3 dimensions are supported. Received {}.'.format(dim)\n",
|
| 68 |
-
" )\n",
|
| 69 |
-
"\n",
|
| 70 |
-
" def forward(self, input):\n",
|
| 71 |
-
" \"\"\"\n",
|
| 72 |
-
" Apply gaussian filter to input.\n",
|
| 73 |
-
" Arguments:\n",
|
| 74 |
-
" input (torch.Tensor): Input to apply gaussian filter on.\n",
|
| 75 |
-
" Returns:\n",
|
| 76 |
-
" filtered (torch.Tensor): Filtered output.\n",
|
| 77 |
-
" \"\"\"\n",
|
| 78 |
-
" return self.conv(input, weight=self.weight, groups=self.groups)"
|
| 79 |
-
]
|
| 80 |
-
},
|
| 81 |
-
{
|
| 82 |
-
"cell_type": "code",
|
| 83 |
-
"execution_count": 18,
|
| 84 |
-
"metadata": {},
|
| 85 |
-
"outputs": [],
|
| 86 |
-
"source": [
|
| 87 |
-
"smoothing = GaussianSmoothing(1024, 5, 1, dim=1)\n",
|
| 88 |
-
"input = torch.rand(4, 16, 100, 64)\n",
|
| 89 |
-
"b = input.shape[0]\n",
|
| 90 |
-
"numhead = input.shape[1]\n",
|
| 91 |
-
"t = input.shape[2]\n",
|
| 92 |
-
"c = input.shape[3]\n",
|
| 93 |
-
"input = input.permute(0,1,3,2)\n",
|
| 94 |
-
"input = input.reshape(b, numhead*c, t)\n",
|
| 95 |
-
"input = F.pad(input, (2, 2), mode='reflect')\n",
|
| 96 |
-
"output = smoothing(input)\n",
|
| 97 |
-
"output = output.reshape(b, numhead, c, t)\n",
|
| 98 |
-
"output = output.permute(0,1,3,2)"
|
| 99 |
-
]
|
| 100 |
-
},
|
| 101 |
-
{
|
| 102 |
-
"cell_type": "code",
|
| 103 |
-
"execution_count": 19,
|
| 104 |
-
"metadata": {},
|
| 105 |
-
"outputs": [
|
| 106 |
-
{
|
| 107 |
-
"data": {
|
| 108 |
-
"text/plain": [
|
| 109 |
-
"torch.Size([4, 16, 100, 64])"
|
| 110 |
-
]
|
| 111 |
-
},
|
| 112 |
-
"execution_count": 19,
|
| 113 |
-
"metadata": {},
|
| 114 |
-
"output_type": "execute_result"
|
| 115 |
-
}
|
| 116 |
-
],
|
| 117 |
-
"source": [
|
| 118 |
-
"input\n",
|
| 119 |
-
"output.shape"
|
| 120 |
-
]
|
| 121 |
-
},
|
| 122 |
-
{
|
| 123 |
-
"cell_type": "code",
|
| 124 |
-
"execution_count": null,
|
| 125 |
-
"metadata": {},
|
| 126 |
-
"outputs": [],
|
| 127 |
-
"source": [
|
| 128 |
-
"input = torch.rand(4, 16, 100, 64)\n",
|
| 129 |
-
"attention = torch.normal(0,1 size = input.shape)"
|
| 130 |
-
]
|
| 131 |
-
}
|
| 132 |
-
],
|
| 133 |
-
"metadata": {
|
| 134 |
-
"kernelspec": {
|
| 135 |
-
"display_name": "Python 3",
|
| 136 |
-
"language": "python",
|
| 137 |
-
"name": "python3"
|
| 138 |
-
},
|
| 139 |
-
"language_info": {
|
| 140 |
-
"codemirror_mode": {
|
| 141 |
-
"name": "ipython",
|
| 142 |
-
"version": 3
|
| 143 |
-
},
|
| 144 |
-
"file_extension": ".py",
|
| 145 |
-
"mimetype": "text/x-python",
|
| 146 |
-
"name": "python",
|
| 147 |
-
"nbconvert_exporter": "python",
|
| 148 |
-
"pygments_lexer": "ipython3",
|
| 149 |
-
"version": "3.8.3"
|
| 150 |
-
}
|
| 151 |
-
},
|
| 152 |
-
"nbformat": 4,
|
| 153 |
-
"nbformat_minor": 4
|
| 154 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/get_incorrect_samples.py
DELETED
|
@@ -1,88 +0,0 @@
|
|
| 1 |
-
r"""Compute active speaker detection performance for the AVA dataset.
|
| 2 |
-
Please send any questions about this code to the Google Group ava-dataset-users:
|
| 3 |
-
https://groups.google.com/forum/#!forum/ava-dataset-users
|
| 4 |
-
Example usage:
|
| 5 |
-
python -O get_ava_active_speaker_performance.py \
|
| 6 |
-
-g testdata/eval.csv \
|
| 7 |
-
-p testdata/predictions.csv \
|
| 8 |
-
-v
|
| 9 |
-
"""
|
| 10 |
-
|
| 11 |
-
from __future__ import absolute_import
|
| 12 |
-
from __future__ import division
|
| 13 |
-
from __future__ import print_function
|
| 14 |
-
|
| 15 |
-
import argparse
|
| 16 |
-
import logging
|
| 17 |
-
import time, warnings
|
| 18 |
-
import numpy as np
|
| 19 |
-
import pandas as pd
|
| 20 |
-
import matplotlib.pyplot as plt
|
| 21 |
-
warnings.filterwarnings("ignore")
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
def parse_arguments():
|
| 25 |
-
"""Parses command-line flags.
|
| 26 |
-
Returns:
|
| 27 |
-
args: a named tuple containing three file objects args.labelmap,
|
| 28 |
-
args.groundtruth, and args.detections.
|
| 29 |
-
"""
|
| 30 |
-
parser = argparse.ArgumentParser()
|
| 31 |
-
parser.add_argument("-g",
|
| 32 |
-
"--groundtruth",
|
| 33 |
-
help="CSV file containing ground truth.",
|
| 34 |
-
type=argparse.FileType("r"),
|
| 35 |
-
required=True)
|
| 36 |
-
parser.add_argument("-p",
|
| 37 |
-
"--predictions",
|
| 38 |
-
help="CSV file containing active speaker predictions.",
|
| 39 |
-
type=argparse.FileType("r"),
|
| 40 |
-
required=True)
|
| 41 |
-
parser.add_argument("-v", "--verbose", help="Increase output verbosity.", action="store_true")
|
| 42 |
-
return parser.parse_args()
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
def run_evaluation(groundtruth, predictions):
|
| 46 |
-
prediction = pd.read_csv(predictions)
|
| 47 |
-
groundtruth = pd.read_csv(groundtruth)
|
| 48 |
-
wrong_list = []
|
| 49 |
-
num = 0
|
| 50 |
-
audible_num = 0
|
| 51 |
-
total = 0
|
| 52 |
-
for i, row in prediction.iterrows():
|
| 53 |
-
entity_id = row['entity_id']
|
| 54 |
-
ts = row['frame_timestamp']
|
| 55 |
-
if row['score'] < 0.5:
|
| 56 |
-
label = "NOT_SPEAKING"
|
| 57 |
-
else:
|
| 58 |
-
label = "SPEAKING_AUDIBLE"
|
| 59 |
-
|
| 60 |
-
true_label = groundtruth.loc[(groundtruth['entity_id'] == entity_id) &
|
| 61 |
-
(groundtruth['frame_timestamp'] == ts)].iloc[0]["label"]
|
| 62 |
-
if true_label != label:
|
| 63 |
-
wrong_list.append([entity_id, ts, true_label, label])
|
| 64 |
-
|
| 65 |
-
if label == "SPEAKING_AUDIBLE":
|
| 66 |
-
num += 1
|
| 67 |
-
if true_label == "SPEAKING_AUDIBLE":
|
| 68 |
-
audible_num += 1
|
| 69 |
-
total += 1
|
| 70 |
-
print(num, audible_num, total)
|
| 71 |
-
|
| 72 |
-
df = pd.DataFrame(wrong_list, columns=['entity_id', 'frame_timestamp', "gt", "prediction"])
|
| 73 |
-
df = df.sort_values(by=["frame_timestamp"])
|
| 74 |
-
df.to_csv("wrong_list.csv")
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
def main():
|
| 78 |
-
start = time.time()
|
| 79 |
-
args = parse_arguments()
|
| 80 |
-
if args.verbose:
|
| 81 |
-
logging.basicConfig(level=logging.DEBUG)
|
| 82 |
-
del args.verbose
|
| 83 |
-
run_evaluation(**vars(args))
|
| 84 |
-
logging.info("Computed in %s seconds", time.time() - start)
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
if __name__ == "__main__":
|
| 88 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|