Add files using upload-large-folder tool
Browse files- Other/Dataset/coco.tar +3 -0
- Other/Dataset/imagenet.tar.gz +3 -0
- Other/Dataset/mirflickr.tar +3 -0
- Other/Dataset/nuswide_v2_256.tar +3 -0
- Other/Dataset/sop.tar +3 -0
- extract_delg_gldv2/embed_delg_gldv2_pretrained.pth +3 -0
- extract_delg_gldv2/getTrainCode_gldv2-new-aug2022.ipynb +341 -0
- extract_delg_gldv2/resnet50_delg_gldv2_pretrained_fixbn.pth +3 -0
- gldv2delgembed.tar.gz +3 -0
- roxford5kdelgembed.tar +3 -0
- rparis6kdelgembed.tar +3 -0
Other/Dataset/coco.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04462969ce7f8472f6b9d2f386148d0a5943cb73b31cdbd0271ca45f4fc6471f
|
| 3 |
+
size 20251719680
|
Other/Dataset/imagenet.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0dfb21fe16edc067351aa41b6de0c5b8aae0271dcf59363643e988ceb81201bf
|
| 3 |
+
size 15541216050
|
Other/Dataset/mirflickr.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04e2a4c30166c60c6c7cbb1fc39128ef861d78d3d5ff1b5fc9921dee3b772e65
|
| 3 |
+
size 3226849280
|
Other/Dataset/nuswide_v2_256.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2854210470fe7370885839236c32d19631eaaea6be6c98283fc6d631022f8a54
|
| 3 |
+
size 12989818880
|
Other/Dataset/sop.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:36ecb6d4465b55c22e72059c653c9ecb6f92fe3fcdb1b488bdf26c1db2107042
|
| 3 |
+
size 3207342080
|
extract_delg_gldv2/embed_delg_gldv2_pretrained.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56f394c43b3fe43920d2d9e6fed5919595017ab194fe12b29870af2bd596773f
|
| 3 |
+
size 16786945
|
extract_delg_gldv2/getTrainCode_gldv2-new-aug2022.ipynb
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 3,
|
| 6 |
+
"id": "c51e1ddd-f84d-4455-8923-8a71d965a3c7",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"import torch\n",
|
| 11 |
+
"import torch.nn as nn\n",
|
| 12 |
+
"import torch.nn.functional as F\n",
|
| 13 |
+
"import numpy as np\n",
|
| 14 |
+
"from scripts.train_helper import prepare_dataloader, prepare_model\n",
|
| 15 |
+
"from functions.metrics import calculate_mAP\n",
|
| 16 |
+
"from tqdm import tqdm\n",
|
| 17 |
+
"from collections import defaultdict\n",
|
| 18 |
+
"from utils.misc import AverageMeter, Timer\n",
|
| 19 |
+
"import configs\n",
|
| 20 |
+
"import os\n",
|
| 21 |
+
"import pandas as pd"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": 4,
|
| 27 |
+
"id": "ba66f7f5-2d95-46b0-a2c8-a0bf03df7c99",
|
| 28 |
+
"metadata": {},
|
| 29 |
+
"outputs": [],
|
| 30 |
+
"source": [
|
| 31 |
+
"device = torch.device(\"cuda:0\")"
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"cell_type": "code",
|
| 36 |
+
"execution_count": 14,
|
| 37 |
+
"id": "2651a4b8-5086-41e2-bbd7-44e0b4b5582d",
|
| 38 |
+
"metadata": {},
|
| 39 |
+
"outputs": [],
|
| 40 |
+
"source": [
|
| 41 |
+
"config = {\n",
|
| 42 |
+
" 'dataset': 'landmark',\n",
|
| 43 |
+
" 'dataset_kwargs': {\n",
|
| 44 |
+
" \"crop\": 512,\n",
|
| 45 |
+
" \"evaluation_protocol\": 1,\n",
|
| 46 |
+
" \"extra_dataset\": 0,\n",
|
| 47 |
+
" \"norm\": 2,\n",
|
| 48 |
+
" \"remove_train_from_db\": False,\n",
|
| 49 |
+
" \"reset\": False,\n",
|
| 50 |
+
" \"resize\": 512,\n",
|
| 51 |
+
" \"separate_multiclass\": False,\n",
|
| 52 |
+
" \"use_db_as_train\": False,\n",
|
| 53 |
+
" 'use_random_augmentation': False\n",
|
| 54 |
+
" },\n",
|
| 55 |
+
" \"arch_kwargs\": {\n",
|
| 56 |
+
" \"nclass\": 81313\n",
|
| 57 |
+
" },\n",
|
| 58 |
+
" 'batch_size': 32\n",
|
| 59 |
+
"}"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "code",
|
| 64 |
+
"execution_count": 6,
|
| 65 |
+
"id": "f3529853-1d17-4e53-9d26-6c130290bc84",
|
| 66 |
+
"metadata": {},
|
| 67 |
+
"outputs": [],
|
| 68 |
+
"source": [
|
| 69 |
+
"resnet = torch.load('/data/jiuntian/delg_pretrained/resnet50_delg_gldv2_pretrained_fixbn.pth', map_location=device)"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"cell_type": "code",
|
| 74 |
+
"execution_count": 7,
|
| 75 |
+
"id": "1de1b5dd-1ff4-47b3-9c43-3641a37f56c3",
|
| 76 |
+
"metadata": {},
|
| 77 |
+
"outputs": [],
|
| 78 |
+
"source": [
|
| 79 |
+
"embedding = torch.load('/data/jiuntian/delg_pretrained/embed_delg_gldv2_pretrained.pth', map_location=device)"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"cell_type": "code",
|
| 84 |
+
"execution_count": 8,
|
| 85 |
+
"id": "390525cc-85e0-4414-b9f7-782c4f58dbf9",
|
| 86 |
+
"metadata": {},
|
| 87 |
+
"outputs": [],
|
| 88 |
+
"source": [
|
| 89 |
+
"class GeM(nn.Module):\n",
|
| 90 |
+
" \"\"\"Generalized Mean Pooling.\n",
|
| 91 |
+
" Paper: https://arxiv.org/pdf/1711.02512.\n",
|
| 92 |
+
" \"\"\"\n",
|
| 93 |
+
"\n",
|
| 94 |
+
" def __init__(self, p: int = 3, eps: float = 1e-6):\n",
|
| 95 |
+
" super().__init__()\n",
|
| 96 |
+
" self.p = p\n",
|
| 97 |
+
" self.eps = eps\n",
|
| 98 |
+
"\n",
|
| 99 |
+
" def forward(self, x):\n",
|
| 100 |
+
" return F.avg_pool2d(x.clamp(min=self.eps).pow(self.p), (x.size(-2), x.size(-1))).pow(1.0 / self.p)"
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"cell_type": "code",
|
| 105 |
+
"execution_count": 9,
|
| 106 |
+
"id": "5d375bf8-21cb-4d98-a310-37e57b63c2fb",
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"outputs": [],
|
| 109 |
+
"source": [
|
| 110 |
+
"gem = GeM(p=3)"
|
| 111 |
+
]
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"cell_type": "code",
|
| 115 |
+
"execution_count": 10,
|
| 116 |
+
"id": "9bffe906-ad06-4f96-b2c1-3345bfb25b82",
|
| 117 |
+
"metadata": {},
|
| 118 |
+
"outputs": [],
|
| 119 |
+
"source": [
|
| 120 |
+
"class ResNet50(nn.Module):\n",
|
| 121 |
+
" def __init__(self):\n",
|
| 122 |
+
" super(ResNet50, self).__init__()\n",
|
| 123 |
+
"\n",
|
| 124 |
+
" model = resnet\n",
|
| 125 |
+
" self.conv1 = model.conv1\n",
|
| 126 |
+
" self.bn1 = model.bn1\n",
|
| 127 |
+
" self.relu = model.relu\n",
|
| 128 |
+
" self.maxpool = model.maxpool\n",
|
| 129 |
+
" self.layer1 = model.layer1\n",
|
| 130 |
+
" self.layer2 = model.layer2\n",
|
| 131 |
+
" self.layer3 = model.layer3\n",
|
| 132 |
+
" self.layer4 = model.layer4\n",
|
| 133 |
+
"# self.avgpool = model.avgpool\n",
|
| 134 |
+
"\n",
|
| 135 |
+
" self.embed = embedding\n",
|
| 136 |
+
" self.gem = gem\n",
|
| 137 |
+
"\n",
|
| 138 |
+
" def forward(self, x):\n",
|
| 139 |
+
" x = self.conv1(x)\n",
|
| 140 |
+
" x = self.bn1(x)\n",
|
| 141 |
+
" x = self.relu(x)\n",
|
| 142 |
+
" x = self.maxpool(x)\n",
|
| 143 |
+
"\n",
|
| 144 |
+
" x = self.layer1(x)\n",
|
| 145 |
+
" x = self.layer2(x)\n",
|
| 146 |
+
" x = self.layer3(x)\n",
|
| 147 |
+
" x = self.layer4(x)\n",
|
| 148 |
+
"\n",
|
| 149 |
+
"# x = self.avgpool(x)\n",
|
| 150 |
+
" x = self.gem(x)\n",
|
| 151 |
+
" \n",
|
| 152 |
+
" x = torch.flatten(x, 1)\n",
|
| 153 |
+
" x = self.embed(x)\n",
|
| 154 |
+
" return x"
|
| 155 |
+
]
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"cell_type": "code",
|
| 159 |
+
"execution_count": 11,
|
| 160 |
+
"id": "f0f6c671-7e7c-4abb-ad41-2f76e1ac4e07",
|
| 161 |
+
"metadata": {},
|
| 162 |
+
"outputs": [],
|
| 163 |
+
"source": [
|
| 164 |
+
"model = ResNet50()"
|
| 165 |
+
]
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"cell_type": "code",
|
| 169 |
+
"execution_count": 12,
|
| 170 |
+
"id": "b1073f29-f58c-462a-a7f8-734ae0be03bb",
|
| 171 |
+
"metadata": {},
|
| 172 |
+
"outputs": [
|
| 173 |
+
{
|
| 174 |
+
"name": "stdout",
|
| 175 |
+
"output_type": "stream",
|
| 176 |
+
"text": [
|
| 177 |
+
"\n"
|
| 178 |
+
]
|
| 179 |
+
}
|
| 180 |
+
],
|
| 181 |
+
"source": [
|
| 182 |
+
"model.to(device)\n",
|
| 183 |
+
"print()"
|
| 184 |
+
]
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"cell_type": "code",
|
| 188 |
+
"execution_count": 15,
|
| 189 |
+
"id": "bfca6ca7-1d69-4a9a-a20d-8d777b6b3d6a",
|
| 190 |
+
"metadata": {},
|
| 191 |
+
"outputs": [],
|
| 192 |
+
"source": [
|
| 193 |
+
"train_dataset = configs.dataset(config, filename='train.txt', transform_mode='train', return_id=True)\n",
|
| 194 |
+
"\n",
|
| 195 |
+
"train_loader = configs.dataloader(train_dataset, config['batch_size'], shuffle=False, drop_last=False)"
|
| 196 |
+
]
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"cell_type": "code",
|
| 200 |
+
"execution_count": 16,
|
| 201 |
+
"id": "d73beaa0-1090-40c9-a1a4-d7ac94a10f3c",
|
| 202 |
+
"metadata": {},
|
| 203 |
+
"outputs": [],
|
| 204 |
+
"source": [
|
| 205 |
+
"def get_codes(model, test_loader, device, return_codes=True, return_id=True):\n",
|
| 206 |
+
" model.eval()\n",
|
| 207 |
+
" meters = defaultdict(AverageMeter)\n",
|
| 208 |
+
" total_timer = Timer()\n",
|
| 209 |
+
" batchtimer = Timer()\n",
|
| 210 |
+
"\n",
|
| 211 |
+
" total_timer.tick()\n",
|
| 212 |
+
"\n",
|
| 213 |
+
" ret_codes = []\n",
|
| 214 |
+
" ret_id = []\n",
|
| 215 |
+
" ret_labels = []\n",
|
| 216 |
+
"\n",
|
| 217 |
+
" pbar = tqdm(test_loader, desc='Test', ascii=True, bar_format='{l_bar}{bar:10}{r_bar}')\n",
|
| 218 |
+
" batchtimer.tick()\n",
|
| 219 |
+
" for i, tuples in enumerate(pbar):\n",
|
| 220 |
+
" (data, labels, image_id) = tuples\n",
|
| 221 |
+
" with torch.no_grad():\n",
|
| 222 |
+
" data = data.to(device)\n",
|
| 223 |
+
" x = model(data)\n",
|
| 224 |
+
"\n",
|
| 225 |
+
" ret_codes.append(x.cpu())\n",
|
| 226 |
+
" ret_id.append(image_id)\n",
|
| 227 |
+
" ret_labels.append(labels.cpu())\n",
|
| 228 |
+
" batchtimer.toc()\n",
|
| 229 |
+
" \n",
|
| 230 |
+
" meters['time'].update(batchtimer.total)\n",
|
| 231 |
+
" batchtimer.tick()\n",
|
| 232 |
+
"\n",
|
| 233 |
+
" pbar.set_postfix({key: val.avg for key, val in meters.items()})\n",
|
| 234 |
+
"\n",
|
| 235 |
+
" total_timer.toc()\n",
|
| 236 |
+
" meters['total_time'].update(total_timer.total)\n",
|
| 237 |
+
"\n",
|
| 238 |
+
" print(f'{\"; \".join([f\"{key}={val.avg:.4f}\" for key, val in meters.items()])}')\n",
|
| 239 |
+
"\n",
|
| 240 |
+
" if return_codes:\n",
|
| 241 |
+
" res = {\n",
|
| 242 |
+
" 'codes': torch.cat(ret_codes),\n",
|
| 243 |
+
" 'id': np.concatenate(ret_id) if len(ret_id) else np.array([]),\n",
|
| 244 |
+
" 'labels': torch.cat(ret_labels)\n",
|
| 245 |
+
" }\n",
|
| 246 |
+
" return meters, res\n",
|
| 247 |
+
"\n",
|
| 248 |
+
" return meters"
|
| 249 |
+
]
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"cell_type": "code",
|
| 253 |
+
"execution_count": 17,
|
| 254 |
+
"id": "fed69362-0704-4cd7-b0bf-47e02f6dc672",
|
| 255 |
+
"metadata": {},
|
| 256 |
+
"outputs": [
|
| 257 |
+
{
|
| 258 |
+
"name": "stderr",
|
| 259 |
+
"output_type": "stream",
|
| 260 |
+
"text": [
|
| 261 |
+
"Test: 0%| | 204/49390 [01:57<7:53:45, 1.73it/s, time=0.575] \n"
|
| 262 |
+
]
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"ename": "KeyboardInterrupt",
|
| 266 |
+
"evalue": "",
|
| 267 |
+
"output_type": "error",
|
| 268 |
+
"traceback": [
|
| 269 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 270 |
+
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
| 271 |
+
"\u001b[0;32m<ipython-input-17-d9be1cc8193f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtrain_meter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrain_out\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_codes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrain_loader\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_codes\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_id\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
| 272 |
+
"\u001b[0;32m<ipython-input-16-14943b1d03d0>\u001b[0m in \u001b[0;36mget_codes\u001b[0;34m(model, test_loader, device, return_codes, return_id)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0mret_codes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcpu\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 22\u001b[0m \u001b[0mret_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimage_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0mret_labels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcpu\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
| 273 |
+
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
|
| 274 |
+
]
|
| 275 |
+
}
|
| 276 |
+
],
|
| 277 |
+
"source": [
|
| 278 |
+
"train_meter, train_out = get_codes(model, train_loader, device, return_codes=True, return_id=True)"
|
| 279 |
+
]
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"cell_type": "code",
|
| 283 |
+
"execution_count": null,
|
| 284 |
+
"id": "634152ff-79d3-4a7c-8df7-08d3c9593095",
|
| 285 |
+
"metadata": {},
|
| 286 |
+
"outputs": [],
|
| 287 |
+
"source": [
|
| 288 |
+
"torch.save(train_out, 'delg_train_out.pth')"
|
| 289 |
+
]
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"cell_type": "code",
|
| 293 |
+
"execution_count": 15,
|
| 294 |
+
"id": "e5f17bfe-a6e5-4e9b-a7f0-d3c325ef7993",
|
| 295 |
+
"metadata": {},
|
| 296 |
+
"outputs": [],
|
| 297 |
+
"source": [
|
| 298 |
+
"# torch.save(db_out, 'delg_db_out.pth')"
|
| 299 |
+
]
|
| 300 |
+
},
|
| 301 |
+
{
|
| 302 |
+
"cell_type": "code",
|
| 303 |
+
"execution_count": 16,
|
| 304 |
+
"id": "b039c7da-f53b-4130-9306-a69e68a370d9",
|
| 305 |
+
"metadata": {},
|
| 306 |
+
"outputs": [],
|
| 307 |
+
"source": [
|
| 308 |
+
"# torch.save(test_out, 'delg_test_out.pth')"
|
| 309 |
+
]
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"cell_type": "code",
|
| 313 |
+
"execution_count": null,
|
| 314 |
+
"id": "1beb6ffe-3a53-4eb7-b392-f5c619a43e32",
|
| 315 |
+
"metadata": {},
|
| 316 |
+
"outputs": [],
|
| 317 |
+
"source": []
|
| 318 |
+
}
|
| 319 |
+
],
|
| 320 |
+
"metadata": {
|
| 321 |
+
"kernelspec": {
|
| 322 |
+
"display_name": "Python 3",
|
| 323 |
+
"language": "python",
|
| 324 |
+
"name": "python3"
|
| 325 |
+
},
|
| 326 |
+
"language_info": {
|
| 327 |
+
"codemirror_mode": {
|
| 328 |
+
"name": "ipython",
|
| 329 |
+
"version": 3
|
| 330 |
+
},
|
| 331 |
+
"file_extension": ".py",
|
| 332 |
+
"mimetype": "text/x-python",
|
| 333 |
+
"name": "python",
|
| 334 |
+
"nbconvert_exporter": "python",
|
| 335 |
+
"pygments_lexer": "ipython3",
|
| 336 |
+
"version": "3.8.5"
|
| 337 |
+
}
|
| 338 |
+
},
|
| 339 |
+
"nbformat": 4,
|
| 340 |
+
"nbformat_minor": 5
|
| 341 |
+
}
|
extract_delg_gldv2/resnet50_delg_gldv2_pretrained_fixbn.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a319d051ba704b22c5744c9d9fb0ab916be2c275f595cfe22c45ed77ecf4e867
|
| 3 |
+
size 102566639
|
gldv2delgembed.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:840c995290db428ed5214b0d83dae7a94ad396cb3009a74975170b73d783427f
|
| 3 |
+
size 17755228676
|
roxford5kdelgembed.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25fa05f0933b22524c2fb6fa9db0156e961a6824fcbec76fe833cbcacbeec03b
|
| 3 |
+
size 83281920
|
rparis6kdelgembed.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69fa8bc36a7fbe2748c9296158b0dd0a2eeeda92444aa0fde1db26a7322bfba7
|
| 3 |
+
size 52756480
|