update
This commit is contained in:
parent
0aaae2cb53
commit
a9f0343660
|
@ -10,26 +10,23 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"ln: failed to create symbolic link './utils': File exists\n",
|
"ln: ./utils: File exists\n",
|
||||||
"ln: failed to create symbolic link './dataset': File exists\n",
|
"ln: ./dataset: File exists\n",
|
||||||
"--2021-02-28 10:56:34-- http://groups.csail.mit.edu/vision/datasets/ADE20K/toolkit/index_ade20k.pkl\n",
|
"--2021-05-12 21:27:23-- http://groups.csail.mit.edu/vision/datasets/ADE20K/toolkit/index_ade20k.pkl\n",
|
||||||
"Resolving groups.csail.mit.edu (groups.csail.mit.edu)... 128.30.2.44\n",
|
"Resolving groups.csail.mit.edu... 128.30.2.44\n",
|
||||||
"Connecting to groups.csail.mit.edu (groups.csail.mit.edu)|128.30.2.44|:80... connected.\n",
|
"Connecting to groups.csail.mit.edu|128.30.2.44|:80... connected.\n",
|
||||||
"HTTP request sent, awaiting response... 200 OK\n",
|
"HTTP request sent, awaiting response... 200 OK\n",
|
||||||
"Length: 817537016 (780M)\n",
|
"Length: 817537016 (780M)\n",
|
||||||
"Saving to: ‘index_ade20k.pkl’\n",
|
"Saving to: 'index_ade20k.pkl'\n",
|
||||||
"\n",
|
"\n",
|
||||||
"index_ade20k.pkl 100%[===================>] 779.66M 65.8MB/s in 12s \n",
|
"index_ade20k.pkl 0%[ ] 5.75M 12.6KB/s eta 13h 54m^C\n"
|
||||||
"\n",
|
|
||||||
"2021-02-28 10:57:44 (63.1 MB/s) - ‘index_ade20k.pkl’ saved [817537016/817537016]\n",
|
|
||||||
"\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -322,7 +319,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.7.1"
|
"version": "3.7.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|
1
notebooks/dataset
Symbolic link
1
notebooks/dataset
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../dataset/
|
106
notebooks/mask_generation.ipynb
Normal file
106
notebooks/mask_generation.ipynb
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"The autoreload extension is already loaded. To reload it, use:\n",
|
||||||
|
" %reload_ext autoreload\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"%load_ext autoreload\n",
|
||||||
|
"%autoreload 2\n",
|
||||||
|
"import IPython.display\n",
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import cv2\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"import pickle as pkl\n",
|
||||||
|
"from utils import utils_ade20k\n",
|
||||||
|
"import os"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"DATASET_PATH = '../dataset/ADE20K_2021_17_01/images/ADE/training/urban/street'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "KeyError",
|
||||||
|
"evalue": "'partclass_mask'",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[0;32m<ipython-input-8-0eeb232ce9a7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconcatenate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mimg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseg_mask\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\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 14\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'off'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'partclass_mask'\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 16\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfigsize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'partclass_mask'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5\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 17\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtitle\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Parts'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[0;31mKeyError\u001b[0m: 'partclass_mask'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"root_path = DATASET_PATH\n",
|
||||||
|
"info = {}\n",
|
||||||
|
"info['img_name']=os.path.join(DATASET_PATH,'ADE_train_00016869.jpg')\n",
|
||||||
|
"info['segm_name']=os.path.join(DATASET_PATH,'ADE_train_00016869_seg.png')\n",
|
||||||
|
"img = cv2.imread(info['img_name'])[:,:,::-1]\n",
|
||||||
|
"seg = cv2.imread(info['segm_name'])[:,:,::-1]\n",
|
||||||
|
"seg_mask = seg.copy()\n",
|
||||||
|
"\n",
|
||||||
|
"# The 0 index in seg_mask corresponds to background (not annotated) pixels\n",
|
||||||
|
"#seg_mask[info['class_mask'] != obj_id+1] *= 0\n",
|
||||||
|
"plt.figure(figsize=(15,5))\n",
|
||||||
|
"\n",
|
||||||
|
"plt.imshow(np.concatenate([img, seg, seg_mask], 1))\n",
|
||||||
|
"plt.axis('off')\n",
|
||||||
|
"if len(info['partclass_mask']):\n",
|
||||||
|
" plt.figure(figsize=(5*len(info['partclass_mask']), 5))\n",
|
||||||
|
" plt.title('Parts')\n",
|
||||||
|
" plt.imshow(np.concatenate(info['partclass_mask'],1))\n",
|
||||||
|
" plt.axis('off')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.7.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
1
notebooks/utils
Symbolic link
1
notebooks/utils
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../utils/
|
Loading…
Reference in New Issue
Block a user