Skip to content

Commit fd7eb9c

Browse files
committed
[Fix] path
1 parent abc1aa2 commit fd7eb9c

File tree

7 files changed

+89
-45
lines changed

7 files changed

+89
-45
lines changed

Diff for: ensemble.ipynb

+13-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@
1010
"from ensemble_boxes import *"
1111
]
1212
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": null,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"!mkdir results"
20+
]
21+
},
1322
{
1423
"cell_type": "code",
1524
"execution_count": null,
1625
"metadata": {},
1726
"outputs": [],
1827
"source": [
1928
"# csv 파일 로드\n",
20-
"file1 = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/01_swin_bbox_safe/submission_best_bbox_mAP_epoch_16.csv'\n",
21-
"file2 = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/cascade-mask-rcnn_convnext-t/submission_best_bbox_mAP_epoch_20.csv'\n",
22-
"file3 = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/02_res2net101_bbox_safe/submission_best_bbox_mAP_epoch_16.csv'\n",
23-
"output_file = '/opt/ml/DACON-objectdetection/results/ensemble.csv'\n",
29+
"file1 = './mmdetection/work_dirs/01_swin_bbox_safe/submission_best_bbox_mAP_epoch_16.csv'\n",
30+
"file2 = './mmdetection/work_dirs/cascade-mask-rcnn_convnext-t/submission_best_bbox_mAP_epoch_20.csv'\n",
31+
"file3 = './mmdetection/work_dirs/02_res2net101_bbox_safe/submission_best_bbox_mAP_epoch_16.csv'\n",
32+
"output_file = './results/ensemble.csv'\n",
2433
"\n",
2534
"df1 = pd.read_csv(file1)\n",
2635
"df2 = pd.read_csv(file2)\n",

Diff for: mmdetection/configs/01_swin_bbox_safe/custom_dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dataset settings
22
dataset_type = 'CocoDataset'
3-
data_root = '/opt/ml/DACON-objectdetection/data/'
3+
data_root = '../data/'
44

55
classes = ('chevrolet_malibu_sedan_2012_2016', 'chevrolet_malibu_sedan_2017_2019', 'chevrolet_spark_hatchback_2016_2021',
66
'chevrolet_trailblazer_suv_2021_', 'chevrolet_trax_suv_2017_2019','genesis_g80_sedan_2016_2020','genesis_g80_sedan_2021_',

Diff for: mmdetection/configs/02_res2net101_bbox_safe/custom_dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dataset settings
22
dataset_type = 'CocoDataset'
3-
data_root = '/opt/ml/DACON-objectdetection/data/'
3+
data_root = '../data/'
44

55
classes = ('chevrolet_malibu_sedan_2012_2016', 'chevrolet_malibu_sedan_2017_2019', 'chevrolet_spark_hatchback_2016_2021',
66
'chevrolet_trailblazer_suv_2021_', 'chevrolet_trax_suv_2017_2019','genesis_g80_sedan_2016_2020','genesis_g80_sedan_2021_',

Diff for: mmdetection_inference.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
" 'ssangyong_tivoli_suv_2016_2020'),\n",
5959
"\n",
6060
"# config file 들고오기\n",
61-
"cfg = Config.fromfile('/opt/ml/DACON-objectdetection/mmdetection/configs/_HJ_/cascade-mask-rcnn_convnext-t.py')\n",
61+
"cfg = Config.fromfile('./mmdetection/configs/_HJ_/cascade-mask-rcnn_convnext-t.py')\n",
6262
"\n",
63-
"root='/opt/ml/DACON-objectdetection/data/'\n",
64-
"working_dir = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/cascade-mask-rcnn_convnext-t'\n",
63+
"root='./data/'\n",
64+
"working_dir = './mmdetection/work_dirs/cascade-mask-rcnn_convnext-t'\n",
6565
"\n",
6666
"epoch = 'best_bbox_mAP_epoch_20'\n",
6767
"\n",

Diff for: mmdetection_inference_01.ipynb

+39-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": null,
15+
"execution_count": 1,
1616
"id": "3fd75793",
1717
"metadata": {},
1818
"outputs": [],
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": null,
37+
"execution_count": 2,
3838
"id": "edda58ea",
3939
"metadata": {},
4040
"outputs": [],
@@ -50,10 +50,10 @@
5050
" 'ssangyong_tivoli_suv_2016_2020'),\n",
5151
"\n",
5252
"# config file 들고오기\n",
53-
"cfg = Config.fromfile('/opt/ml/DACON-objectdetection/mmdetection/configs/01_swin_bbox_safe/01_swin_bbox_safe.py')\n",
53+
"cfg = Config.fromfile('./mmdetection/configs/01_swin_bbox_safe/01_swin_bbox_safe.py')\n",
5454
"\n",
55-
"root='/opt/ml/DACON-objectdetection/data/'\n",
56-
"working_dir = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/01_swin_bbox_safe'\n",
55+
"root='./data/'\n",
56+
"working_dir = './mmdetection/work_dirs/01_swin_bbox_safe'\n",
5757
"\n",
5858
"epoch = 'best_bbox_mAP_epoch_16'\n",
5959
"\n",
@@ -63,7 +63,7 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"execution_count": null,
66+
"execution_count": 3,
6767
"id": "58ccaae0",
6868
"metadata": {},
6969
"outputs": [],
@@ -77,10 +77,21 @@
7777
},
7878
{
7979
"cell_type": "code",
80-
"execution_count": null,
80+
"execution_count": 4,
8181
"id": "b086a8cf",
8282
"metadata": {},
83-
"outputs": [],
83+
"outputs": [
84+
{
85+
"name": "stdout",
86+
"output_type": "stream",
87+
"text": [
88+
"loading annotations into memory...\n",
89+
"Done (t=0.01s)\n",
90+
"creating index...\n",
91+
"index created!\n"
92+
]
93+
}
94+
],
8495
"source": [
8596
"# build dataset & dataloader\n",
8697
"dataset = build_dataset(cfg.data.test)\n",
@@ -94,10 +105,18 @@
94105
},
95106
{
96107
"cell_type": "code",
97-
"execution_count": null,
108+
"execution_count": 5,
98109
"id": "83b3eae6",
99110
"metadata": {},
100-
"outputs": [],
111+
"outputs": [
112+
{
113+
"name": "stdout",
114+
"output_type": "stream",
115+
"text": [
116+
"load checkpoint from local path: /opt/ml/DACON-objectdetection/mmdetection/work_dirs/01_swin_bbox_safe/best_bbox_mAP_epoch_16.pth\n"
117+
]
118+
}
119+
],
101120
"source": [
102121
"# checkpoint path\n",
103122
"checkpoint_path = os.path.join(working_dir, f'{epoch}.pth')\n",
@@ -111,10 +130,18 @@
111130
},
112131
{
113132
"cell_type": "code",
114-
"execution_count": null,
133+
"execution_count": 6,
115134
"id": "c9f5c2bb",
116135
"metadata": {},
117-
"outputs": [],
136+
"outputs": [
137+
{
138+
"name": "stdout",
139+
"output_type": "stream",
140+
"text": [
141+
"[>>>>>>>>>>>>>>>>>>>>>>>>>>] 3400/3400, 10.9 task/s, elapsed: 313s, ETA: 0s"
142+
]
143+
}
144+
],
118145
"source": [
119146
"output = single_gpu_test(model, data_loader) # output 계산"
120147
]

Diff for: mmdetection_inference_02.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
" 'ssangyong_tivoli_suv_2016_2020'),\n",
5959
"\n",
6060
"# config file 들고오기\n",
61-
"cfg = Config.fromfile('/opt/ml/DACON-objectdetection/mmdetection/configs/02_res2net101_bbox_safe/02_res2net101_bbox_safe.py')\n",
61+
"cfg = Config.fromfile('./mmdetection/configs/02_res2net101_bbox_safe/02_res2net101_bbox_safe.py')\n",
6262
"\n",
63-
"root='/opt/ml/DACON-objectdetection/data/'\n",
64-
"working_dir = '/opt/ml/DACON-objectdetection/mmdetection/work_dirs/02_res2net101_bbox_safe'\n",
63+
"root='./data/'\n",
64+
"working_dir = './mmdetection/work_dirs/02_res2net101_bbox_safe'\n",
6565
"\n",
6666
"epoch = 'best_bbox_mAP_epoch_16'\n",
6767
"\n",

Diff for: val_aug.ipynb

+29-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 15,
5+
"execution_count": null,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -12,6 +12,15 @@
1212
"import albumentations as A"
1313
]
1414
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"!mkdir ./data/val/"
22+
]
23+
},
1524
{
1625
"attachments": {},
1726
"cell_type": "markdown",
@@ -22,7 +31,7 @@
2231
},
2332
{
2433
"cell_type": "code",
25-
"execution_count": 16,
34+
"execution_count": null,
2635
"metadata": {},
2736
"outputs": [],
2837
"source": [
@@ -77,28 +86,20 @@
7786
},
7887
{
7988
"cell_type": "code",
80-
"execution_count": 17,
89+
"execution_count": null,
8190
"metadata": {},
8291
"outputs": [],
8392
"source": [
84-
"image_dir = '/opt/ml/DACON-objectdetection/data'\n",
85-
"annotation_file = '/opt/ml/DACON-objectdetection/data/K-fold_val1.json'\n",
86-
"output_dir = '/opt/ml/DACON-objectdetection/data/val'"
93+
"image_dir = './data'\n",
94+
"annotation_file = './data/K-fold_val1.json'\n",
95+
"output_dir = './data/val'"
8796
]
8897
},
8998
{
9099
"cell_type": "code",
91-
"execution_count": 18,
100+
"execution_count": null,
92101
"metadata": {},
93-
"outputs": [
94-
{
95-
"name": "stdout",
96-
"output_type": "stream",
97-
"text": [
98-
"Augmentation completed.\n"
99-
]
100-
}
101-
],
102+
"outputs": [],
102103
"source": [
103104
"augment_images_with_bbox(image_dir, annotation_file, output_dir)"
104105
]
@@ -113,7 +114,7 @@
113114
},
114115
{
115116
"cell_type": "code",
116-
"execution_count": 12,
117+
"execution_count": null,
117118
"metadata": {},
118119
"outputs": [],
119120
"source": [
@@ -123,7 +124,7 @@
123124
"for image_data in annotations['images']:\n",
124125
" image_data['file_name'] = image_data['file_name'].replace(\"train/\", \"val/augmented_\")\n",
125126
" \n",
126-
"with open('/opt/ml/DACON-objectdetection/data/augmented_val.json', 'w') as f:\n",
127+
"with open('./data/augmented_val.json', 'w') as f:\n",
127128
" json.dump(annotations, f)"
128129
]
129130
},
@@ -137,19 +138,19 @@
137138
},
138139
{
139140
"cell_type": "code",
140-
"execution_count": 19,
141+
"execution_count": null,
141142
"metadata": {},
142143
"outputs": [],
143144
"source": [
144145
"from glob import glob\n",
145146
"\n",
146-
"img_path = '/opt/ml/DACON-objectdetection/data/val/*.png'\n",
147+
"img_path = './data/val/*.png'\n",
147148
"img_pathes = glob(img_path)"
148149
]
149150
},
150151
{
151152
"cell_type": "code",
152-
"execution_count": 20,
153+
"execution_count": null,
153154
"metadata": {},
154155
"outputs": [],
155156
"source": [
@@ -170,6 +171,13 @@
170171
" # Save augmented image\n",
171172
" cv2.imwrite(img_path, cv2.cvtColor(augmented_image, cv2.COLOR_RGB2BGR))\n"
172173
]
174+
},
175+
{
176+
"cell_type": "code",
177+
"execution_count": null,
178+
"metadata": {},
179+
"outputs": [],
180+
"source": []
173181
}
174182
],
175183
"metadata": {

0 commit comments

Comments
 (0)