Download MOT17 subset from blob and minor fixes to markdown

This commit is contained in:
Alejandro Buendia 2020-07-13 07:59:45 +00:00
Родитель c33350277f
Коммит 1fc25db7e2
2 изменённых файлов: 79 добавлений и 50 удалений

Просмотреть файл

@ -126,7 +126,6 @@
"MOT_ROOT_PATH = \"../../data/\"\n",
"RESULT_ROOT = \"./results\"\n",
"EXP_NAME = \"MOT_val_all_dla34\"\n",
"MOTCHALLENGE_BASE_URL = \"https://motchallenge.net/data/\"\n",
"\n",
"# Pretrained model location\n",
"MODEL_DIR = unzip_url(Urls.baseline_models_path, \"./models\", exist_ok=True)\n",
@ -148,7 +147,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we will download the [MOT17](https://motchallenge.net/data/MOT17.zip) dataset and save it to `MOT_SAVED_PATH`. Note: MOT17 is around 5GB and it may take some time to download."
"Now, we will download the [MOT17](https://motchallenge.net/data/MOT17.zip) dataset and save it to `MOT_SAVED_PATH`. \n",
"\n",
"Note: We extract a subset of MOT17 which is around 2 GB. It may take some time to download."
]
},
{
@ -157,25 +158,18 @@
"metadata": {},
"outputs": [
{
"ename": "BadZipFile",
"evalue": "Bad magic number for file header",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mBadZipFile\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-1a25c5c52656>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 22\u001b[0m ]\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0munzip_url\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmot_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mMOT_ROOT_PATH\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\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\u001b[1;32m 25\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Training data saved to {mot_train_path}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Test data saved to {mot_test_path}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/data/home/lishao/computervision-recipes/utils_cv/common/data.py\u001b[0m in \u001b[0;36munzip_url\u001b[0;34m(url, fpath, dest, exist_ok)\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0mz\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mZipFile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mzip_file\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"r\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 115\u001b[0;31m \u001b[0mz\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextractall\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfpath\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 116\u001b[0m \u001b[0mz\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\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[1;32m 117\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/data/anaconda/envs/cv/lib/python3.7/zipfile.py\u001b[0m in \u001b[0;36mextractall\u001b[0;34m(self, path, members, pwd)\u001b[0m\n\u001b[1;32m 1634\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1635\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mzipinfo\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mmembers\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1636\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_extract_member\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mzipinfo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpwd\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 1637\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1638\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mclassmethod\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/data/anaconda/envs/cv/lib/python3.7/zipfile.py\u001b[0m in \u001b[0;36m_extract_member\u001b[0;34m(self, member, targetpath, pwd)\u001b[0m\n\u001b[1;32m 1687\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mtargetpath\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1688\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1689\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmember\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpwd\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpwd\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0msource\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m\\\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1690\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtargetpath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"wb\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtarget\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1691\u001b[0m \u001b[0mshutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcopyfileobj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msource\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtarget\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/data/anaconda/envs/cv/lib/python3.7/zipfile.py\u001b[0m in \u001b[0;36mopen\u001b[0;34m(self, name, mode, pwd, force_zip64)\u001b[0m\n\u001b[1;32m 1522\u001b[0m \u001b[0mfheader\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstruct\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munpack\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstructFileHeader\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfheader\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1523\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfheader\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0m_FH_SIGNATURE\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mstringFileHeader\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1524\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mBadZipFile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Bad magic number for file header\"\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 1525\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1526\u001b[0m \u001b[0mfname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mzef_file\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfheader\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0m_FH_FILENAME_LENGTH\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[0;31mBadZipFile\u001b[0m: Bad magic number for file header"
"name": "stdout",
"output_type": "stream",
"text": [
"Training data saved to /home/albuendi/computervision-recipes/data/MOT17/train\n",
"Test data saved to /home/albuendi/computervision-recipes/data/MOT17/test\n"
]
}
],
"source": [
"mot_path = urljoin(MOTCHALLENGE_BASE_URL, \"MOT17.zip\")\n",
"mot_train_path = osp.join(MOT_ROOT_PATH, \"MOT17\", \"train\")\n",
"mot_test_path = osp.join(MOT_ROOT_PATH, \"MOT17\", \"test\")\n",
"mot_path = unzip_url(Urls.mot_challenge_path, MOT_ROOT_PATH, exist_ok=True)\n",
"mot_train_path = osp.join(mot_path, \"train\")\n",
"mot_test_path = osp.join(mot_path, \"test\")\n",
"# seqs_str: various video sequences subfolder names under MOT challenge data\n",
"train_seqs = [\n",
" \"MOT17-02-SDP\",\n",
@ -196,44 +190,20 @@
" \"MOT17-14-SDP\",\n",
"]\n",
"\n",
"unzip_url(mot_path, dest=MOT_ROOT_PATH, exist_ok=True)\n",
"print(f\"Training data saved to {mot_train_path}\")\n",
"print(f\"Test data saved to {mot_test_path}\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"b'PK\\x03\\x04'\n",
"https://motchallenge.net/data/MOT17.zip\n"
]
}
],
"source": [
"with open('../../data/MOT17.zip', 'rb') as MyZip:\n",
" print(MyZip.read(4))\n",
" \n",
"\"\\x50\\x4B\\x03\\x04\" \n",
"\n",
"print(mot_path)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The code below initializes and loads the model using the TrackingLearner class."
"The code below initializes and loads the model using the `TrackingLearner` class."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@ -258,9 +228,46 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-02-SDP.txt\n",
"Evaluate seq: MOT17-02-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-04-SDP.txt\n",
"Evaluate seq: MOT17-04-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-05-SDP.txt\n",
"Evaluate seq: MOT17-05-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-09-SDP.txt\n",
"Evaluate seq: MOT17-09-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-10-SDP.txt\n",
"Evaluate seq: MOT17-10-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-11-SDP.txt\n",
"Evaluate seq: MOT17-11-SDP\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-13-SDP.txt\n",
"Evaluate seq: MOT17-13-SDP\n",
" IDF1 IDP IDR Rcll Prcn GT MT PT ML FP FN IDs FM MOTA MOTP IDt IDa IDm\n",
"MOT17-02-SDP 64.3% 77.8% 54.7% 68.6% 97.4% 62 22 31 9 334 5839 181 641 65.8% 0.192 108 36 13\n",
"MOT17-04-SDP 83.7% 86.2% 81.4% 86.3% 91.4% 83 51 20 12 3884 6520 26 200 78.1% 0.170 4 18 2\n",
"MOT17-05-SDP 78.0% 85.2% 71.8% 81.0% 96.2% 133 62 60 11 224 1313 70 211 76.8% 0.198 73 29 38\n",
"MOT17-09-SDP 68.9% 75.2% 63.5% 81.2% 96.3% 26 18 8 0 166 999 56 108 77.1% 0.163 40 12 7\n",
"MOT17-10-SDP 63.9% 70.9% 58.1% 78.7% 96.0% 57 33 24 0 421 2732 153 424 74.3% 0.213 89 42 14\n",
"MOT17-11-SDP 85.6% 87.9% 83.4% 90.4% 95.3% 75 52 19 4 424 905 41 130 85.5% 0.156 26 18 12\n",
"MOT17-13-SDP 75.4% 80.4% 71.0% 83.7% 94.8% 110 72 31 7 531 1893 85 367 78.4% 0.205 69 24 33\n",
"OVERALL 76.8% 82.4% 72.0% 82.0% 93.9% 546 310 193 43 5984 20201 612 2081 76.1% 0.182 409 179 119\n"
]
}
],
"source": [
"strsummary = tracker.eval_mot(\n",
" conf_thres=CONF_THRES,\n",
@ -288,7 +295,7 @@
"\n",
"<img src=\"media/mot_results.PNG\" style=\"width: 737.5px;height: 365px\"/>\n",
"\n",
"The reported evaluation results from the [FairMOT paper](https://arxiv.org/abs/2004.01888) with test set are as follows:\n",
"The reported evaluation results from the [FairMOT paper](https://arxiv.org/abs/2004.01888) with the test set are as follows:\n",
"\n",
"| Dataset | MOTA | IDF1 | IDS | MT | ML | FPS |\n",
"|------|------|------|------|------|------|------|\n",
@ -298,9 +305,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-01-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-03-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-06-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-07-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-08-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-12-SDP.txt\n",
"loaded /home/albuendi/computervision-recipes/scenarios/tracking/models/baselines/all_dla34.pth, epoch 10\n",
"Saved tracking results to ./results/MOT_val_all_dla34/MOT17-14-SDP.txt\n"
]
}
],
"source": [
"tracker.eval_mot(\n",
" conf_thres=CONF_THRES,\n",
@ -316,9 +344,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python (cv)",
"language": "python",
"name": "python3"
"name": "cv"
},
"language_info": {
"codemirror_mode": {

Просмотреть файл

@ -12,6 +12,7 @@ class Urls:
cans_path = urljoin(datasets_base, "cans.zip")
fridge_objects_path = urljoin(datasets_base, "odFridgeObjects_FairMOT-Format.zip")
carcans_annotations_path = urljoin(datasets_base, "carcans_vott-csv-export.zip")
mot_challenge_path = urljoin(datasets_base, "MOT17.zip")
baseline_models_path = urljoin(models_base, "baselines.zip")
@classmethod