general load file's size

pull/13566/head
StrickenSun 2025-04-17 11:57:42 +08:00
parent 4afe9a152b
commit 9899722b9e
1 changed files with 18 additions and 7 deletions
data_process

View File

@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 4,
"id": "335bf1ae",
"metadata": {},
"outputs": [],
@ -47,7 +47,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 12,
"id": "b8fe5313",
"metadata": {},
"outputs": [],
@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 13,
"id": "101e48e9",
"metadata": {},
"outputs": [],
@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 14,
"id": "6edd8ee3",
"metadata": {},
"outputs": [],
@ -88,7 +88,18 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 15,
"id": "6c24ffe6",
"metadata": {},
"outputs": [],
"source": [
"img_height = content['images'][0]['height']\n",
"img_width = content['images'][0]['height']"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "a9923894",
"metadata": {},
"outputs": [],
@ -97,8 +108,8 @@
"for label_info in content['annotations']:\n",
" img_name = dict_id2img[label_info['image_id']]\n",
" class_name = label_info['category_id']\n",
" x_center = (label_info['bbox'][0] + label_info['bbox'][2] / 2) / 640\n",
" y_center = (label_info['bbox'][1] + label_info['bbox'][3] / 2) / 640\n",
" x_center = (label_info['bbox'][0] + label_info['bbox'][2] / 2) / img_height\n",
" y_center = (label_info['bbox'][1] + label_info['bbox'][3] / 2) / img_width\n",
" w = label_info['bbox'][1] / 640\n",
" h = label_info['bbox'][3] / 640\n",
" with open(os.path.join(img_folder.replace(\"images\", \"labels\"), img_name.replace(\".jpg\", \".txt\")), 'a') as f:\n",