Skip to content

Instantly share code, notes, and snippets.

@myounus96
Last active March 5, 2020 13:04
Show Gist options
  • Save myounus96/0dc22345c1f7585e60855a0544e00b08 to your computer and use it in GitHub Desktop.
Save myounus96/0dc22345c1f7585e60855a0544e00b08 to your computer and use it in GitHub Desktop.
Cattle detection and counting in UAV images based on convolutional neural networks (gist for dataset preparation for yolov3)
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [],
"source": [
"data1 = []\n",
"with open('dataset1_annotation.txt','r') as f:\n",
" data1 = f.readlines()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"657"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(data1)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"auto1\\DJI_0006.JPG 1 0 2549 54 77 1 1 1 \n"
]
}
],
"source": [
"print(data1[6].replace('\\t',' ').replace('\\n',''))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'auto1\\\\DJI_0007.JPG 0 \\n'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1[7].replace('\\t',' ')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'auto1\\\\DJI_0012.JPG 1 69 643 96 90 0 1 1 \\n'"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1[12].replace('\\t',' ')"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['image num x y w h quality id id_confidence',\n",
" 'auto1\\\\DJI_0001.JPG 1 148 0 114 101 1 1 1',\n",
" 'auto1\\\\DJI_0002.JPG 1 0 431 78 74 1 1 1',\n",
" 'auto1\\\\DJI_0003.JPG 0']"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1 = list( map(lambda x:x.replace('\\t',' ').replace('\\n','').strip(), data1) )\n",
"data1[:4]"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [],
"source": [
"with open('temp.txt','w') as f:\n",
" f.write('\\n'.join( data1) )"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"' '"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1[0][-3]"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"34"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(data1[0].replace(' ',''))"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['auto1\\\\DJI_0003.JPG', '0']"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1[3].split()"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"from pdb import set_trace"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [],
"source": [
"for d in data1[1:]:\n",
" \n",
" start = 0\n",
" content = d.split()\n",
" \n",
" singleImageData = []\n",
" fileName = f'Dataset1-annotations/{ content.pop(0)[:-4] }.txt'\n",
" num = int(content.pop(0))\n",
" for _ in range( num ):\n",
" \n",
" singleImageData.append(' '.join( [ str(0), *content[start:start+4] ] ) )\n",
"# set_trace()\n",
" start += 7\n",
" \n",
" if num > 0:\n",
" with open(fileName, 'w') as f:\n",
" f.write('\\n'.join( singleImageData ) )\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'auto1\\\\DJI_0017.JPG 4 2010 1127 92 94 0 1 1 2307 823 67 110 0 2 1 2433 713 77 108 0 3 1 2333 640 90 80 0 4 1'"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data1[17]"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['auto7\\\\DJI_0160.JPG', '0']"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"content"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'auto7\\\\DJI_0160.JPG'"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"content.pop(0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### copying images from dataset1 to dataset1-annotations"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import shutil"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import cv2"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from glob import glob"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"['Dataset1/auto1/DJI_0001.JPG',\n",
" 'Dataset1/auto1/DJI_0002.JPG',\n",
" 'Dataset1/auto1/DJI_0003.JPG',\n",
" 'Dataset1/auto1/DJI_0004.JPG',\n",
" 'Dataset1/auto1/DJI_0005.JPG',\n",
" 'Dataset1/auto1/DJI_0006.JPG',\n",
" 'Dataset1/auto1/DJI_0007.JPG',\n",
" 'Dataset1/auto1/DJI_0008.JPG',\n",
" 'Dataset1/auto1/DJI_0009.JPG',\n",
" 'Dataset1/auto1/DJI_0010.JPG',\n",
" 'Dataset1/auto1/DJI_0011.JPG',\n",
" 'Dataset1/auto1/DJI_0012.JPG',\n",
" 'Dataset1/auto1/DJI_0013.JPG',\n",
" 'Dataset1/auto1/DJI_0014.JPG',\n",
" 'Dataset1/auto1/DJI_0015.JPG',\n",
" 'Dataset1/auto1/DJI_0016.JPG',\n",
" 'Dataset1/auto1/DJI_0017.JPG',\n",
" 'Dataset1/auto1/DJI_0018.JPG',\n",
" 'Dataset1/auto1/DJI_0019.JPG',\n",
" 'Dataset1/auto1/DJI_0020.JPG',\n",
" 'Dataset1/auto1/DJI_0021.JPG',\n",
" 'Dataset1/auto1/DJI_0022.JPG',\n",
" 'Dataset1/auto1/DJI_0023.JPG',\n",
" 'Dataset1/auto1/DJI_0024.JPG',\n",
" 'Dataset1/auto1/DJI_0025.JPG',\n",
" 'Dataset1/auto1/DJI_0026.JPG',\n",
" 'Dataset1/auto1/DJI_0027.JPG',\n",
" 'Dataset1/auto1/DJI_0028.JPG',\n",
" 'Dataset1/auto1/DJI_0029.JPG',\n",
" 'Dataset1/auto1/DJI_0030.JPG',\n",
" 'Dataset1/auto1/DJI_0031.JPG',\n",
" 'Dataset1/auto1/DJI_0032.JPG',\n",
" 'Dataset1/auto2/DJI_0050.JPG',\n",
" 'Dataset1/auto2/DJI_0033.JPG',\n",
" 'Dataset1/auto2/DJI_0034.JPG',\n",
" 'Dataset1/auto2/DJI_0035.JPG',\n",
" 'Dataset1/auto2/DJI_0036.JPG',\n",
" 'Dataset1/auto2/DJI_0037.JPG',\n",
" 'Dataset1/auto2/DJI_0038.JPG',\n",
" 'Dataset1/auto2/DJI_0039.JPG',\n",
" 'Dataset1/auto2/DJI_0040.JPG',\n",
" 'Dataset1/auto2/DJI_0041.JPG',\n",
" 'Dataset1/auto2/DJI_0042.JPG',\n",
" 'Dataset1/auto2/DJI_0043.JPG',\n",
" 'Dataset1/auto2/DJI_0044.JPG',\n",
" 'Dataset1/auto2/DJI_0045.JPG',\n",
" 'Dataset1/auto2/DJI_0046.JPG',\n",
" 'Dataset1/auto2/DJI_0047.JPG',\n",
" 'Dataset1/auto2/DJI_0048.JPG',\n",
" 'Dataset1/auto2/DJI_0049.JPG',\n",
" 'Dataset1/auto2/DJI_0051.JPG',\n",
" 'Dataset1/auto2/DJI_0052.JPG',\n",
" 'Dataset1/auto2/DJI_0053.JPG',\n",
" 'Dataset1/auto2/DJI_0054.JPG',\n",
" 'Dataset1/auto2/DJI_0055.JPG',\n",
" 'Dataset1/auto2/DJI_0056.JPG',\n",
" 'Dataset1/auto2/DJI_0057.JPG',\n",
" 'Dataset1/auto2/DJI_0058.JPG',\n",
" 'Dataset1/auto2/DJI_0059.JPG',\n",
" 'Dataset1/auto2/DJI_0060.JPG',\n",
" 'Dataset1/auto2/DJI_0061.JPG',\n",
" 'Dataset1/auto2/DJI_0062.JPG',\n",
" 'Dataset1/auto2/DJI_0063.JPG',\n",
" 'Dataset1/auto2/DJI_0064.JPG',\n",
" 'Dataset1/auto2/DJI_0065.JPG',\n",
" 'Dataset1/auto2/DJI_0066.JPG',\n",
" 'Dataset1/auto2/DJI_0067.JPG',\n",
" 'Dataset1/auto2/DJI_0068.JPG',\n",
" 'Dataset1/auto2/DJI_0069.JPG',\n",
" 'Dataset1/auto2/DJI_0070.JPG',\n",
" 'Dataset1/auto2/DJI_0071.JPG',\n",
" 'Dataset1/auto2/DJI_0072.JPG',\n",
" 'Dataset1/auto2/DJI_0073.JPG',\n",
" 'Dataset1/auto2/DJI_0074.JPG',\n",
" 'Dataset1/auto2/DJI_0075.JPG',\n",
" 'Dataset1/auto2/DJI_0076.JPG',\n",
" 'Dataset1/auto2/DJI_0077.JPG',\n",
" 'Dataset1/auto3/DJI_0095.JPG',\n",
" 'Dataset1/auto3/DJI_0078.JPG',\n",
" 'Dataset1/auto3/DJI_0079.JPG',\n",
" 'Dataset1/auto3/DJI_0080.JPG',\n",
" 'Dataset1/auto3/DJI_0081.JPG',\n",
" 'Dataset1/auto3/DJI_0082.JPG',\n",
" 'Dataset1/auto3/DJI_0083.JPG',\n",
" 'Dataset1/auto3/DJI_0084.JPG',\n",
" 'Dataset1/auto3/DJI_0085.JPG',\n",
" 'Dataset1/auto3/DJI_0086.JPG',\n",
" 'Dataset1/auto3/DJI_0087.JPG',\n",
" 'Dataset1/auto3/DJI_0088.JPG',\n",
" 'Dataset1/auto3/DJI_0089.JPG',\n",
" 'Dataset1/auto3/DJI_0090.JPG',\n",
" 'Dataset1/auto3/DJI_0091.JPG',\n",
" 'Dataset1/auto3/DJI_0092.JPG',\n",
" 'Dataset1/auto3/DJI_0093.JPG',\n",
" 'Dataset1/auto3/DJI_0094.JPG',\n",
" 'Dataset1/auto3/DJI_0096.JPG',\n",
" 'Dataset1/auto3/DJI_0097.JPG',\n",
" 'Dataset1/auto3/DJI_0098.JPG',\n",
" 'Dataset1/auto3/DJI_0099.JPG',\n",
" 'Dataset1/auto3/DJI_0100.JPG',\n",
" 'Dataset1/auto3/DJI_0101.JPG',\n",
" 'Dataset1/auto3/DJI_0102.JPG',\n",
" 'Dataset1/auto3/DJI_0103.JPG',\n",
" 'Dataset1/auto3/DJI_0104.JPG',\n",
" 'Dataset1/auto3/DJI_0105.JPG',\n",
" 'Dataset1/auto3/DJI_0106.JPG',\n",
" 'Dataset1/auto3/DJI_0107.JPG',\n",
" 'Dataset1/auto3/DJI_0108.JPG',\n",
" 'Dataset1/auto3/DJI_0109.JPG',\n",
" 'Dataset1/auto3/DJI_0110.JPG',\n",
" 'Dataset1/auto3/DJI_0111.JPG',\n",
" 'Dataset1/auto3/DJI_0112.JPG',\n",
" 'Dataset1/auto3/DJI_0113.JPG',\n",
" 'Dataset1/auto4/DJI_0018.JPG',\n",
" 'Dataset1/auto4/DJI_0001.JPG',\n",
" 'Dataset1/auto4/DJI_0002.JPG',\n",
" 'Dataset1/auto4/DJI_0003.JPG',\n",
" 'Dataset1/auto4/DJI_0004.JPG',\n",
" 'Dataset1/auto4/DJI_0005.JPG',\n",
" 'Dataset1/auto4/DJI_0006.JPG',\n",
" 'Dataset1/auto4/DJI_0007.JPG',\n",
" 'Dataset1/auto4/DJI_0008.JPG',\n",
" 'Dataset1/auto4/DJI_0009.JPG',\n",
" 'Dataset1/auto4/DJI_0010.JPG',\n",
" 'Dataset1/auto4/DJI_0011.JPG',\n",
" 'Dataset1/auto4/DJI_0012.JPG',\n",
" 'Dataset1/auto4/DJI_0013.JPG',\n",
" 'Dataset1/auto4/DJI_0014.JPG',\n",
" 'Dataset1/auto4/DJI_0015.JPG',\n",
" 'Dataset1/auto4/DJI_0016.JPG',\n",
" 'Dataset1/auto4/DJI_0017.JPG',\n",
" 'Dataset1/auto4/DJI_0019.JPG',\n",
" 'Dataset1/auto4/DJI_0020.JPG',\n",
" 'Dataset1/auto4/DJI_0021.JPG',\n",
" 'Dataset1/auto4/DJI_0022.JPG',\n",
" 'Dataset1/auto4/DJI_0023.JPG',\n",
" 'Dataset1/auto4/DJI_0024.JPG',\n",
" 'Dataset1/auto4/DJI_0025.JPG',\n",
" 'Dataset1/auto4/DJI_0026.JPG',\n",
" 'Dataset1/auto4/DJI_0027.JPG',\n",
" 'Dataset1/auto4/DJI_0028.JPG',\n",
" 'Dataset1/auto4/DJI_0029.JPG',\n",
" 'Dataset1/auto4/DJI_0030.JPG',\n",
" 'Dataset1/auto4/DJI_0031.JPG',\n",
" 'Dataset1/auto4/DJI_0032.JPG',\n",
" 'Dataset1/auto4/DJI_0033.JPG',\n",
" 'Dataset1/auto4/DJI_0034.JPG',\n",
" 'Dataset1/auto4/DJI_0035.JPG',\n",
" 'Dataset1/auto4/DJI_0036.JPG',\n",
" 'Dataset1/auto4/DJI_0037.JPG',\n",
" 'Dataset1/auto4/DJI_0038.JPG',\n",
" 'Dataset1/auto4/DJI_0039.JPG',\n",
" 'Dataset1/auto4/DJI_0040.JPG',\n",
" 'Dataset1/auto5/DJI_0041.JPG',\n",
" 'Dataset1/auto5/DJI_0042.JPG',\n",
" 'Dataset1/auto5/DJI_0043.JPG',\n",
" 'Dataset1/auto5/DJI_0044.JPG',\n",
" 'Dataset1/auto5/DJI_0045.JPG',\n",
" 'Dataset1/auto5/DJI_0046.JPG',\n",
" 'Dataset1/auto5/DJI_0047.JPG',\n",
" 'Dataset1/auto5/DJI_0048.JPG',\n",
" 'Dataset1/auto5/DJI_0049.JPG',\n",
" 'Dataset1/auto5/DJI_0050.JPG',\n",
" 'Dataset1/auto5/DJI_0051.JPG',\n",
" 'Dataset1/auto5/DJI_0052.JPG',\n",
" 'Dataset1/auto5/DJI_0053.JPG',\n",
" 'Dataset1/auto5/DJI_0054.JPG',\n",
" 'Dataset1/auto5/DJI_0055.JPG',\n",
" 'Dataset1/auto5/DJI_0056.JPG',\n",
" 'Dataset1/auto5/DJI_0057.JPG',\n",
" 'Dataset1/auto5/DJI_0059.JPG',\n",
" 'Dataset1/auto5/DJI_0060.JPG',\n",
" 'Dataset1/auto5/DJI_0061.JPG',\n",
" 'Dataset1/auto5/DJI_0062.JPG',\n",
" 'Dataset1/auto5/DJI_0063.JPG',\n",
" 'Dataset1/auto5/DJI_0064.JPG',\n",
" 'Dataset1/auto5/DJI_0065.JPG',\n",
" 'Dataset1/auto5/DJI_0066.JPG',\n",
" 'Dataset1/auto5/DJI_0067.JPG',\n",
" 'Dataset1/auto5/DJI_0068.JPG',\n",
" 'Dataset1/auto5/DJI_0069.JPG',\n",
" 'Dataset1/auto5/DJI_0070.JPG',\n",
" 'Dataset1/auto5/DJI_0071.JPG',\n",
" 'Dataset1/auto5/DJI_0072.JPG',\n",
" 'Dataset1/auto5/DJI_0073.JPG',\n",
" 'Dataset1/auto5/DJI_0074.JPG',\n",
" 'Dataset1/auto5/DJI_0075.JPG',\n",
" 'Dataset1/auto5/DJI_0077.JPG',\n",
" 'Dataset1/auto5/DJI_0078.JPG',\n",
" 'Dataset1/auto5/DJI_0079.JPG',\n",
" 'Dataset1/auto5/DJI_0080.JPG',\n",
" 'Dataset1/auto5/DJI_0081.JPG',\n",
" 'Dataset1/auto5/DJI_0082.JPG',\n",
" 'Dataset1/auto5/DJI_0083.JPG',\n",
" 'Dataset1/auto5/DJI_0084.JPG',\n",
" 'Dataset1/auto5/DJI_0085.JPG',\n",
" 'Dataset1/auto5/DJI_0086.JPG',\n",
" 'Dataset1/auto5/DJI_0087.JPG',\n",
" 'Dataset1/auto5/DJI_0088.JPG',\n",
" 'Dataset1/auto5/DJI_0089.JPG',\n",
" 'Dataset1/auto5/DJI_0090.JPG',\n",
" 'Dataset1/auto5/DJI_0091.JPG',\n",
" 'Dataset1/auto5/DJI_0092.JPG',\n",
" 'Dataset1/auto5/DJI_0093.JPG',\n",
" 'Dataset1/auto5/DJI_0095.JPG',\n",
" 'Dataset1/auto5/DJI_0096.JPG',\n",
" 'Dataset1/auto5/DJI_0097.JPG',\n",
" 'Dataset1/auto5/DJI_0098.JPG',\n",
" 'Dataset1/auto5/DJI_0099.JPG',\n",
" 'Dataset1/auto5/DJI_0100.JPG',\n",
" 'Dataset1/auto5/DJI_0101.JPG',\n",
" 'Dataset1/auto5/DJI_0102.JPG',\n",
" 'Dataset1/auto5/DJI_0103.JPG',\n",
" 'Dataset1/auto5/DJI_0104.JPG',\n",
" 'Dataset1/auto5/DJI_0105.JPG',\n",
" 'Dataset1/auto5/DJI_0106.JPG',\n",
" 'Dataset1/auto5/DJI_0107.JPG',\n",
" 'Dataset1/auto5/DJI_0108.JPG',\n",
" 'Dataset1/auto5/DJI_0109.JPG',\n",
" 'Dataset1/auto5/DJI_0110.JPG',\n",
" 'Dataset1/auto5/DJI_0111.JPG',\n",
" 'Dataset1/auto5/DJI_0058.JPG',\n",
" 'Dataset1/auto5/DJI_0076.JPG',\n",
" 'Dataset1/auto5/DJI_0094.JPG',\n",
" 'Dataset1/auto5/DJI_0112.JPG',\n",
" 'Dataset1/auto5/DJI_0130.JPG',\n",
" 'Dataset1/auto5/DJI_0148.JPG',\n",
" 'Dataset1/auto5/DJI_0166.JPG',\n",
" 'Dataset1/auto5/DJI_0184.JPG',\n",
" 'Dataset1/auto5/DJI_0202.JPG',\n",
" 'Dataset1/auto5/DJI_0113.JPG',\n",
" 'Dataset1/auto5/DJI_0114.JPG',\n",
" 'Dataset1/auto5/DJI_0115.JPG',\n",
" 'Dataset1/auto5/DJI_0116.JPG',\n",
" 'Dataset1/auto5/DJI_0117.JPG',\n",
" 'Dataset1/auto5/DJI_0118.JPG',\n",
" 'Dataset1/auto5/DJI_0119.JPG',\n",
" 'Dataset1/auto5/DJI_0120.JPG',\n",
" 'Dataset1/auto5/DJI_0121.JPG',\n",
" 'Dataset1/auto5/DJI_0122.JPG',\n",
" 'Dataset1/auto5/DJI_0123.JPG',\n",
" 'Dataset1/auto5/DJI_0124.JPG',\n",
" 'Dataset1/auto5/DJI_0125.JPG',\n",
" 'Dataset1/auto5/DJI_0126.JPG',\n",
" 'Dataset1/auto5/DJI_0127.JPG',\n",
" 'Dataset1/auto5/DJI_0128.JPG',\n",
" 'Dataset1/auto5/DJI_0129.JPG',\n",
" 'Dataset1/auto5/DJI_0131.JPG',\n",
" 'Dataset1/auto5/DJI_0132.JPG',\n",
" 'Dataset1/auto5/DJI_0133.JPG',\n",
" 'Dataset1/auto5/DJI_0134.JPG',\n",
" 'Dataset1/auto5/DJI_0135.JPG',\n",
" 'Dataset1/auto5/DJI_0136.JPG',\n",
" 'Dataset1/auto5/DJI_0137.JPG',\n",
" 'Dataset1/auto5/DJI_0138.JPG',\n",
" 'Dataset1/auto5/DJI_0139.JPG',\n",
" 'Dataset1/auto5/DJI_0140.JPG',\n",
" 'Dataset1/auto5/DJI_0141.JPG',\n",
" 'Dataset1/auto5/DJI_0142.JPG',\n",
" 'Dataset1/auto5/DJI_0143.JPG',\n",
" 'Dataset1/auto5/DJI_0144.JPG',\n",
" 'Dataset1/auto5/DJI_0145.JPG',\n",
" 'Dataset1/auto5/DJI_0146.JPG',\n",
" 'Dataset1/auto5/DJI_0147.JPG',\n",
" 'Dataset1/auto5/DJI_0149.JPG',\n",
" 'Dataset1/auto5/DJI_0150.JPG',\n",
" 'Dataset1/auto5/DJI_0151.JPG',\n",
" 'Dataset1/auto5/DJI_0152.JPG',\n",
" 'Dataset1/auto5/DJI_0153.JPG',\n",
" 'Dataset1/auto5/DJI_0154.JPG',\n",
" 'Dataset1/auto5/DJI_0155.JPG',\n",
" 'Dataset1/auto5/DJI_0156.JPG',\n",
" 'Dataset1/auto5/DJI_0157.JPG',\n",
" 'Dataset1/auto5/DJI_0158.JPG',\n",
" 'Dataset1/auto5/DJI_0159.JPG',\n",
" 'Dataset1/auto5/DJI_0160.JPG',\n",
" 'Dataset1/auto5/DJI_0161.JPG',\n",
" 'Dataset1/auto5/DJI_0162.JPG',\n",
" 'Dataset1/auto5/DJI_0163.JPG',\n",
" 'Dataset1/auto5/DJI_0164.JPG',\n",
" 'Dataset1/auto5/DJI_0165.JPG',\n",
" 'Dataset1/auto5/DJI_0167.JPG',\n",
" 'Dataset1/auto5/DJI_0168.JPG',\n",
" 'Dataset1/auto5/DJI_0169.JPG',\n",
" 'Dataset1/auto5/DJI_0170.JPG',\n",
" 'Dataset1/auto5/DJI_0171.JPG',\n",
" 'Dataset1/auto5/DJI_0172.JPG',\n",
" 'Dataset1/auto5/DJI_0173.JPG',\n",
" 'Dataset1/auto5/DJI_0174.JPG',\n",
" 'Dataset1/auto5/DJI_0175.JPG',\n",
" 'Dataset1/auto5/DJI_0176.JPG',\n",
" 'Dataset1/auto5/DJI_0177.JPG',\n",
" 'Dataset1/auto5/DJI_0178.JPG',\n",
" 'Dataset1/auto5/DJI_0179.JPG',\n",
" 'Dataset1/auto5/DJI_0180.JPG',\n",
" 'Dataset1/auto5/DJI_0181.JPG',\n",
" 'Dataset1/auto5/DJI_0182.JPG',\n",
" 'Dataset1/auto5/DJI_0183.JPG',\n",
" 'Dataset1/auto5/DJI_0185.JPG',\n",
" 'Dataset1/auto5/DJI_0186.JPG',\n",
" 'Dataset1/auto5/DJI_0187.JPG',\n",
" 'Dataset1/auto5/DJI_0188.JPG',\n",
" 'Dataset1/auto5/DJI_0189.JPG',\n",
" 'Dataset1/auto5/DJI_0190.JPG',\n",
" 'Dataset1/auto5/DJI_0191.JPG',\n",
" 'Dataset1/auto5/DJI_0192.JPG',\n",
" 'Dataset1/auto5/DJI_0193.JPG',\n",
" 'Dataset1/auto5/DJI_0194.JPG',\n",
" 'Dataset1/auto5/DJI_0195.JPG',\n",
" 'Dataset1/auto5/DJI_0196.JPG',\n",
" 'Dataset1/auto5/DJI_0197.JPG',\n",
" 'Dataset1/auto5/DJI_0198.JPG',\n",
" 'Dataset1/auto5/DJI_0199.JPG',\n",
" 'Dataset1/auto5/DJI_0200.JPG',\n",
" 'Dataset1/auto5/DJI_0201.JPG',\n",
" 'Dataset1/auto5/DJI_0203.JPG',\n",
" 'Dataset1/auto5/DJI_0204.JPG',\n",
" 'Dataset1/auto5/DJI_0205.JPG',\n",
" 'Dataset1/auto5/DJI_0206.JPG',\n",
" 'Dataset1/auto5/DJI_0207.JPG',\n",
" 'Dataset1/auto5/DJI_0208.JPG',\n",
" 'Dataset1/auto5/DJI_0209.JPG',\n",
" 'Dataset1/auto5/DJI_0210.JPG',\n",
" 'Dataset1/auto5/DJI_0211.JPG',\n",
" 'Dataset1/auto5/DJI_0212.JPG',\n",
" 'Dataset1/auto5/DJI_0213.JPG',\n",
" 'Dataset1/auto5/DJI_0214.JPG',\n",
" 'Dataset1/auto5/DJI_0215.JPG',\n",
" 'Dataset1/auto5/DJI_0216.JPG',\n",
" 'Dataset1/auto5/DJI_0217.JPG',\n",
" 'Dataset1/auto5/DJI_0218.JPG',\n",
" 'Dataset1/auto5/DJI_0219.JPG',\n",
" 'Dataset1/auto5/DJI_0220.JPG',\n",
" 'Dataset1/auto5/DJI_0221.JPG',\n",
" 'Dataset1/auto5/DJI_0222.JPG',\n",
" 'Dataset1/auto5/DJI_0223.JPG',\n",
" 'Dataset1/auto5/DJI_0224.JPG',\n",
" 'Dataset1/auto6/DJI_0002.JPG',\n",
" 'Dataset1/auto6/DJI_0003.JPG',\n",
" 'Dataset1/auto6/DJI_0004.JPG',\n",
" 'Dataset1/auto6/DJI_0005.JPG',\n",
" 'Dataset1/auto6/DJI_0006.JPG',\n",
" 'Dataset1/auto6/DJI_0007.JPG',\n",
" 'Dataset1/auto6/DJI_0008.JPG',\n",
" 'Dataset1/auto6/DJI_0009.JPG',\n",
" 'Dataset1/auto6/DJI_0010.JPG',\n",
" 'Dataset1/auto6/DJI_0011.JPG',\n",
" 'Dataset1/auto6/DJI_0012.JPG',\n",
" 'Dataset1/auto6/DJI_0013.JPG',\n",
" 'Dataset1/auto6/DJI_0014.JPG',\n",
" 'Dataset1/auto6/DJI_0015.JPG',\n",
" 'Dataset1/auto6/DJI_0016.JPG',\n",
" 'Dataset1/auto6/DJI_0017.JPG',\n",
" 'Dataset1/auto6/DJI_0018.JPG',\n",
" 'Dataset1/auto6/DJI_0020.JPG',\n",
" 'Dataset1/auto6/DJI_0021.JPG',\n",
" 'Dataset1/auto6/DJI_0022.JPG',\n",
" 'Dataset1/auto6/DJI_0023.JPG',\n",
" 'Dataset1/auto6/DJI_0024.JPG',\n",
" 'Dataset1/auto6/DJI_0025.JPG',\n",
" 'Dataset1/auto6/DJI_0026.JPG',\n",
" 'Dataset1/auto6/DJI_0027.JPG',\n",
" 'Dataset1/auto6/DJI_0028.JPG',\n",
" 'Dataset1/auto6/DJI_0029.JPG',\n",
" 'Dataset1/auto6/DJI_0030.JPG',\n",
" 'Dataset1/auto6/DJI_0031.JPG',\n",
" 'Dataset1/auto6/DJI_0032.JPG',\n",
" 'Dataset1/auto6/DJI_0033.JPG',\n",
" 'Dataset1/auto6/DJI_0034.JPG',\n",
" 'Dataset1/auto6/DJI_0035.JPG',\n",
" 'Dataset1/auto6/DJI_0036.JPG',\n",
" 'Dataset1/auto6/DJI_0038.JPG',\n",
" 'Dataset1/auto6/DJI_0039.JPG',\n",
" 'Dataset1/auto6/DJI_0040.JPG',\n",
" 'Dataset1/auto6/DJI_0041.JPG',\n",
" 'Dataset1/auto6/DJI_0042.JPG',\n",
" 'Dataset1/auto6/DJI_0043.JPG',\n",
" 'Dataset1/auto6/DJI_0044.JPG',\n",
" 'Dataset1/auto6/DJI_0045.JPG',\n",
" 'Dataset1/auto6/DJI_0046.JPG',\n",
" 'Dataset1/auto6/DJI_0047.JPG',\n",
" 'Dataset1/auto6/DJI_0048.JPG',\n",
" 'Dataset1/auto6/DJI_0049.JPG',\n",
" 'Dataset1/auto6/DJI_0050.JPG',\n",
" 'Dataset1/auto6/DJI_0051.JPG',\n",
" 'Dataset1/auto6/DJI_0052.JPG',\n",
" 'Dataset1/auto6/DJI_0053.JPG',\n",
" 'Dataset1/auto6/DJI_0054.JPG',\n",
" 'Dataset1/auto6/DJI_0056.JPG',\n",
" 'Dataset1/auto6/DJI_0057.JPG',\n",
" 'Dataset1/auto6/DJI_0058.JPG',\n",
" 'Dataset1/auto6/DJI_0059.JPG',\n",
" 'Dataset1/auto6/DJI_0060.JPG',\n",
" 'Dataset1/auto6/DJI_0061.JPG',\n",
" 'Dataset1/auto6/DJI_0062.JPG',\n",
" 'Dataset1/auto6/DJI_0063.JPG',\n",
" 'Dataset1/auto6/DJI_0064.JPG',\n",
" 'Dataset1/auto6/DJI_0065.JPG',\n",
" 'Dataset1/auto6/DJI_0066.JPG',\n",
" 'Dataset1/auto6/DJI_0067.JPG',\n",
" 'Dataset1/auto6/DJI_0068.JPG',\n",
" 'Dataset1/auto6/DJI_0069.JPG',\n",
" 'Dataset1/auto6/DJI_0070.JPG',\n",
" 'Dataset1/auto6/DJI_0071.JPG',\n",
" 'Dataset1/auto6/DJI_0072.JPG',\n",
" 'Dataset1/auto6/DJI_0019.JPG',\n",
" 'Dataset1/auto6/DJI_0037.JPG',\n",
" 'Dataset1/auto6/DJI_0055.JPG',\n",
" 'Dataset1/auto6/DJI_0073.JPG',\n",
" 'Dataset1/auto6/DJI_0091.JPG',\n",
" 'Dataset1/auto6/DJI_0109.JPG',\n",
" 'Dataset1/auto6/DJI_0127.JPG',\n",
" 'Dataset1/auto6/DJI_0074.JPG',\n",
" 'Dataset1/auto6/DJI_0075.JPG',\n",
" 'Dataset1/auto6/DJI_0076.JPG',\n",
" 'Dataset1/auto6/DJI_0077.JPG',\n",
" 'Dataset1/auto6/DJI_0078.JPG',\n",
" 'Dataset1/auto6/DJI_0079.JPG',\n",
" 'Dataset1/auto6/DJI_0080.JPG',\n",
" 'Dataset1/auto6/DJI_0081.JPG',\n",
" 'Dataset1/auto6/DJI_0082.JPG',\n",
" 'Dataset1/auto6/DJI_0083.JPG',\n",
" 'Dataset1/auto6/DJI_0084.JPG',\n",
" 'Dataset1/auto6/DJI_0085.JPG',\n",
" 'Dataset1/auto6/DJI_0086.JPG',\n",
" 'Dataset1/auto6/DJI_0087.JPG',\n",
" 'Dataset1/auto6/DJI_0088.JPG',\n",
" 'Dataset1/auto6/DJI_0089.JPG',\n",
" 'Dataset1/auto6/DJI_0090.JPG',\n",
" 'Dataset1/auto6/DJI_0092.JPG',\n",
" 'Dataset1/auto6/DJI_0093.JPG',\n",
" 'Dataset1/auto6/DJI_0094.JPG',\n",
" 'Dataset1/auto6/DJI_0095.JPG',\n",
" 'Dataset1/auto6/DJI_0096.JPG',\n",
" 'Dataset1/auto6/DJI_0097.JPG',\n",
" 'Dataset1/auto6/DJI_0098.JPG',\n",
" 'Dataset1/auto6/DJI_0099.JPG',\n",
" 'Dataset1/auto6/DJI_0100.JPG',\n",
" 'Dataset1/auto6/DJI_0101.JPG',\n",
" 'Dataset1/auto6/DJI_0102.JPG',\n",
" 'Dataset1/auto6/DJI_0103.JPG',\n",
" 'Dataset1/auto6/DJI_0104.JPG',\n",
" 'Dataset1/auto6/DJI_0105.JPG',\n",
" 'Dataset1/auto6/DJI_0106.JPG',\n",
" 'Dataset1/auto6/DJI_0107.JPG',\n",
" 'Dataset1/auto6/DJI_0108.JPG',\n",
" 'Dataset1/auto6/DJI_0110.JPG',\n",
" 'Dataset1/auto6/DJI_0111.JPG',\n",
" 'Dataset1/auto6/DJI_0112.JPG',\n",
" 'Dataset1/auto6/DJI_0113.JPG',\n",
" 'Dataset1/auto6/DJI_0114.JPG',\n",
" 'Dataset1/auto6/DJI_0115.JPG',\n",
" 'Dataset1/auto6/DJI_0116.JPG',\n",
" 'Dataset1/auto6/DJI_0117.JPG',\n",
" 'Dataset1/auto6/DJI_0118.JPG',\n",
" 'Dataset1/auto6/DJI_0119.JPG',\n",
" 'Dataset1/auto6/DJI_0120.JPG',\n",
" 'Dataset1/auto6/DJI_0121.JPG',\n",
" 'Dataset1/auto6/DJI_0122.JPG',\n",
" 'Dataset1/auto6/DJI_0123.JPG',\n",
" 'Dataset1/auto6/DJI_0124.JPG',\n",
" 'Dataset1/auto6/DJI_0125.JPG',\n",
" 'Dataset1/auto6/DJI_0126.JPG',\n",
" 'Dataset1/auto6/DJI_0128.JPG',\n",
" 'Dataset1/auto6/DJI_0129.JPG',\n",
" 'Dataset1/auto6/DJI_0130.JPG',\n",
" 'Dataset1/auto6/DJI_0131.JPG',\n",
" 'Dataset1/auto6/DJI_0132.JPG',\n",
" 'Dataset1/auto6/DJI_0133.JPG',\n",
" 'Dataset1/auto6/DJI_0134.JPG',\n",
" 'Dataset1/auto6/DJI_0135.JPG',\n",
" 'Dataset1/auto6/DJI_0136.JPG',\n",
" 'Dataset1/auto6/DJI_0137.JPG',\n",
" 'Dataset1/auto6/DJI_0138.JPG',\n",
" 'Dataset1/auto6/DJI_0139.JPG',\n",
" 'Dataset1/auto6/DJI_0140.JPG',\n",
" 'Dataset1/auto6/DJI_0141.JPG',\n",
" 'Dataset1/auto6/DJI_0142.JPG',\n",
" 'Dataset1/auto6/DJI_0143.JPG',\n",
" 'Dataset1/auto6/DJI_0144.JPG',\n",
" 'Dataset1/auto6/DJI_0145.JPG',\n",
" 'Dataset1/auto6/DJI_0146.JPG',\n",
" 'Dataset1/auto6/DJI_0147.JPG',\n",
" 'Dataset1/auto6/DJI_0148.JPG',\n",
" 'Dataset1/auto6/DJI_0149.JPG',\n",
" 'Dataset1/auto6/DJI_0150.JPG',\n",
" 'Dataset1/auto6/DJI_0151.JPG',\n",
" 'Dataset1/auto6/DJI_0152.JPG',\n",
" 'Dataset1/auto6/DJI_0153.JPG',\n",
" 'Dataset1/auto6/DJI_0154.JPG',\n",
" 'Dataset1/auto6/DJI_0155.JPG',\n",
" 'Dataset1/auto6/DJI_0156.JPG',\n",
" 'Dataset1/auto6/DJI_0157.JPG',\n",
" 'Dataset1/auto6/DJI_0158.JPG',\n",
" 'Dataset1/auto6/DJI_0159.JPG',\n",
" 'Dataset1/auto6/DJI_0160.JPG',\n",
" 'Dataset1/auto7/DJI_0001.JPG',\n",
" 'Dataset1/auto7/DJI_0002.JPG',\n",
" 'Dataset1/auto7/DJI_0003.JPG',\n",
" 'Dataset1/auto7/DJI_0004.JPG',\n",
" 'Dataset1/auto7/DJI_0005.JPG',\n",
" 'Dataset1/auto7/DJI_0006.JPG',\n",
" 'Dataset1/auto7/DJI_0007.JPG',\n",
" 'Dataset1/auto7/DJI_0008.JPG',\n",
" 'Dataset1/auto7/DJI_0009.JPG',\n",
" 'Dataset1/auto7/DJI_0010.JPG',\n",
" 'Dataset1/auto7/DJI_0011.JPG',\n",
" 'Dataset1/auto7/DJI_0012.JPG',\n",
" 'Dataset1/auto7/DJI_0013.JPG',\n",
" 'Dataset1/auto7/DJI_0014.JPG',\n",
" 'Dataset1/auto7/DJI_0015.JPG',\n",
" 'Dataset1/auto7/DJI_0016.JPG',\n",
" 'Dataset1/auto7/DJI_0017.JPG',\n",
" 'Dataset1/auto7/DJI_0019.JPG',\n",
" 'Dataset1/auto7/DJI_0020.JPG',\n",
" 'Dataset1/auto7/DJI_0021.JPG',\n",
" 'Dataset1/auto7/DJI_0022.JPG',\n",
" 'Dataset1/auto7/DJI_0023.JPG',\n",
" 'Dataset1/auto7/DJI_0024.JPG',\n",
" 'Dataset1/auto7/DJI_0025.JPG',\n",
" 'Dataset1/auto7/DJI_0026.JPG',\n",
" 'Dataset1/auto7/DJI_0027.JPG',\n",
" 'Dataset1/auto7/DJI_0028.JPG',\n",
" 'Dataset1/auto7/DJI_0029.JPG',\n",
" 'Dataset1/auto7/DJI_0030.JPG',\n",
" 'Dataset1/auto7/DJI_0031.JPG',\n",
" 'Dataset1/auto7/DJI_0032.JPG',\n",
" 'Dataset1/auto7/DJI_0033.JPG',\n",
" 'Dataset1/auto7/DJI_0034.JPG',\n",
" 'Dataset1/auto7/DJI_0035.JPG',\n",
" 'Dataset1/auto7/DJI_0037.JPG',\n",
" 'Dataset1/auto7/DJI_0038.JPG',\n",
" 'Dataset1/auto7/DJI_0039.JPG',\n",
" 'Dataset1/auto7/DJI_0040.JPG',\n",
" 'Dataset1/auto7/DJI_0041.JPG',\n",
" 'Dataset1/auto7/DJI_0042.JPG',\n",
" 'Dataset1/auto7/DJI_0043.JPG',\n",
" 'Dataset1/auto7/DJI_0044.JPG',\n",
" 'Dataset1/auto7/DJI_0045.JPG',\n",
" 'Dataset1/auto7/DJI_0046.JPG',\n",
" 'Dataset1/auto7/DJI_0047.JPG',\n",
" 'Dataset1/auto7/DJI_0048.JPG',\n",
" 'Dataset1/auto7/DJI_0049.JPG',\n",
" 'Dataset1/auto7/DJI_0050.JPG',\n",
" 'Dataset1/auto7/DJI_0051.JPG',\n",
" 'Dataset1/auto7/DJI_0052.JPG',\n",
" 'Dataset1/auto7/DJI_0053.JPG',\n",
" 'Dataset1/auto7/DJI_0055.JPG',\n",
" 'Dataset1/auto7/DJI_0056.JPG',\n",
" 'Dataset1/auto7/DJI_0057.JPG',\n",
" 'Dataset1/auto7/DJI_0058.JPG',\n",
" 'Dataset1/auto7/DJI_0059.JPG',\n",
" 'Dataset1/auto7/DJI_0060.JPG',\n",
" 'Dataset1/auto7/DJI_0061.JPG',\n",
" 'Dataset1/auto7/DJI_0062.JPG',\n",
" 'Dataset1/auto7/DJI_0063.JPG',\n",
" 'Dataset1/auto7/DJI_0064.JPG',\n",
" 'Dataset1/auto7/DJI_0065.JPG',\n",
" 'Dataset1/auto7/DJI_0066.JPG',\n",
" 'Dataset1/auto7/DJI_0067.JPG',\n",
" 'Dataset1/auto7/DJI_0068.JPG',\n",
" 'Dataset1/auto7/DJI_0069.JPG',\n",
" 'Dataset1/auto7/DJI_0070.JPG',\n",
" 'Dataset1/auto7/DJI_0071.JPG',\n",
" 'Dataset1/auto7/DJI_0018.JPG',\n",
" 'Dataset1/auto7/DJI_0036.JPG',\n",
" 'Dataset1/auto7/DJI_0054.JPG',\n",
" 'Dataset1/auto7/DJI_0072.JPG',\n",
" 'Dataset1/auto7/DJI_0090.JPG',\n",
" 'Dataset1/auto7/DJI_0108.JPG',\n",
" 'Dataset1/auto7/DJI_0126.JPG',\n",
" 'Dataset1/auto7/DJI_0073.JPG',\n",
" 'Dataset1/auto7/DJI_0074.JPG',\n",
" 'Dataset1/auto7/DJI_0075.JPG',\n",
" 'Dataset1/auto7/DJI_0076.JPG',\n",
" 'Dataset1/auto7/DJI_0077.JPG',\n",
" 'Dataset1/auto7/DJI_0078.JPG',\n",
" 'Dataset1/auto7/DJI_0079.JPG',\n",
" 'Dataset1/auto7/DJI_0080.JPG',\n",
" 'Dataset1/auto7/DJI_0081.JPG',\n",
" 'Dataset1/auto7/DJI_0082.JPG',\n",
" 'Dataset1/auto7/DJI_0083.JPG',\n",
" 'Dataset1/auto7/DJI_0084.JPG',\n",
" 'Dataset1/auto7/DJI_0085.JPG',\n",
" 'Dataset1/auto7/DJI_0086.JPG',\n",
" 'Dataset1/auto7/DJI_0087.JPG',\n",
" 'Dataset1/auto7/DJI_0088.JPG',\n",
" 'Dataset1/auto7/DJI_0089.JPG',\n",
" 'Dataset1/auto7/DJI_0091.JPG',\n",
" 'Dataset1/auto7/DJI_0092.JPG',\n",
" 'Dataset1/auto7/DJI_0093.JPG',\n",
" 'Dataset1/auto7/DJI_0094.JPG',\n",
" 'Dataset1/auto7/DJI_0095.JPG',\n",
" 'Dataset1/auto7/DJI_0096.JPG',\n",
" 'Dataset1/auto7/DJI_0097.JPG',\n",
" 'Dataset1/auto7/DJI_0098.JPG',\n",
" 'Dataset1/auto7/DJI_0099.JPG',\n",
" 'Dataset1/auto7/DJI_0100.JPG',\n",
" 'Dataset1/auto7/DJI_0101.JPG',\n",
" 'Dataset1/auto7/DJI_0102.JPG',\n",
" 'Dataset1/auto7/DJI_0103.JPG',\n",
" 'Dataset1/auto7/DJI_0104.JPG',\n",
" 'Dataset1/auto7/DJI_0105.JPG',\n",
" 'Dataset1/auto7/DJI_0106.JPG',\n",
" 'Dataset1/auto7/DJI_0107.JPG',\n",
" 'Dataset1/auto7/DJI_0109.JPG',\n",
" 'Dataset1/auto7/DJI_0110.JPG',\n",
" 'Dataset1/auto7/DJI_0111.JPG',\n",
" 'Dataset1/auto7/DJI_0112.JPG',\n",
" 'Dataset1/auto7/DJI_0113.JPG',\n",
" 'Dataset1/auto7/DJI_0114.JPG',\n",
" 'Dataset1/auto7/DJI_0115.JPG',\n",
" 'Dataset1/auto7/DJI_0116.JPG',\n",
" 'Dataset1/auto7/DJI_0117.JPG',\n",
" 'Dataset1/auto7/DJI_0118.JPG',\n",
" 'Dataset1/auto7/DJI_0119.JPG',\n",
" 'Dataset1/auto7/DJI_0120.JPG',\n",
" 'Dataset1/auto7/DJI_0121.JPG',\n",
" 'Dataset1/auto7/DJI_0122.JPG',\n",
" 'Dataset1/auto7/DJI_0123.JPG',\n",
" 'Dataset1/auto7/DJI_0124.JPG',\n",
" 'Dataset1/auto7/DJI_0125.JPG',\n",
" 'Dataset1/auto7/DJI_0127.JPG',\n",
" 'Dataset1/auto7/DJI_0128.JPG',\n",
" 'Dataset1/auto7/DJI_0129.JPG',\n",
" 'Dataset1/auto7/DJI_0130.JPG',\n",
" 'Dataset1/auto7/DJI_0131.JPG',\n",
" 'Dataset1/auto7/DJI_0132.JPG',\n",
" 'Dataset1/auto7/DJI_0133.JPG',\n",
" 'Dataset1/auto7/DJI_0134.JPG',\n",
" 'Dataset1/auto7/DJI_0135.JPG',\n",
" 'Dataset1/auto7/DJI_0136.JPG',\n",
" 'Dataset1/auto7/DJI_0137.JPG',\n",
" 'Dataset1/auto7/DJI_0138.JPG',\n",
" 'Dataset1/auto7/DJI_0139.JPG',\n",
" 'Dataset1/auto7/DJI_0140.JPG',\n",
" 'Dataset1/auto7/DJI_0141.JPG',\n",
" 'Dataset1/auto7/DJI_0142.JPG',\n",
" 'Dataset1/auto7/DJI_0143.JPG',\n",
" 'Dataset1/auto7/DJI_0144.JPG',\n",
" 'Dataset1/auto7/DJI_0145.JPG',\n",
" 'Dataset1/auto7/DJI_0146.JPG',\n",
" 'Dataset1/auto7/DJI_0147.JPG',\n",
" 'Dataset1/auto7/DJI_0148.JPG',\n",
" 'Dataset1/auto7/DJI_0149.JPG',\n",
" 'Dataset1/auto7/DJI_0150.JPG',\n",
" 'Dataset1/auto7/DJI_0151.JPG',\n",
" 'Dataset1/auto7/DJI_0152.JPG',\n",
" 'Dataset1/auto7/DJI_0153.JPG',\n",
" 'Dataset1/auto7/DJI_0154.JPG',\n",
" 'Dataset1/auto7/DJI_0155.JPG',\n",
" 'Dataset1/auto7/DJI_0156.JPG',\n",
" 'Dataset1/auto7/DJI_0157.JPG',\n",
" 'Dataset1/auto7/DJI_0158.JPG',\n",
" 'Dataset1/auto7/DJI_0159.JPG',\n",
" 'Dataset1/auto7/DJI_0160.JPG']"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"glob('Dataset1/*/*')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Dataset1-annotations/auto1\\\\DJI_0001.txt',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0002.txt',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0005.txt',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0006.txt',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0011.txt']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"txtFiles = glob('Dataset1-annotations/*')\n",
"txtFiles[:5]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"cv2.imshow('abc',cv2.imread('Dataset1/auto1/DJI_0017.JPG'))\n",
"cv2.waitKey(0)\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"317"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(txtFiles)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"634"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"317*2"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"scrolled": true
},
"outputs": [
{
"ename": "IndexError",
"evalue": "list index out of range",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-9-ecf13f73b296>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtxtFiles\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0msubFolder\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'\\\\'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/'\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[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mimgFile\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'\\\\'\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[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'.'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;34m'.JPG'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0mshutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf'Dataset1/{subFolder}/{imgFile}'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34mf'Dataset1-annotations/{subFolder}\\\\{imgFile}'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mIndexError\u001b[0m: list index out of range"
]
}
],
"source": [
"for f in txtFiles[:-1]:\n",
" subFolder = f.split('\\\\')[0].split('/')[1]\n",
" imgFile = f.split('\\\\')[1].split('.')[0]+'.JPG'\n",
" print( shutil.copy(f'Dataset1/{subFolder}/{imgFile}',f'Dataset1-annotations/{subFolder}\\\\{imgFile}') )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### validating bboxes(values from paper)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### first convert this format to x1y1x2y2 then use xyxy2xywh func"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.05125 0.016833333333333332 0.0285 0.033666666666666664\n"
]
}
],
"source": [
"#this thing is working\n",
"x1,y1 = 148, 0\n",
"#convert papers w,h to x2,y2\n",
"x2, y2 = (148+114), (0+101)\n",
"\n",
"x,y,w,h = (x1 + x2) / 2, (y1 + y2) / 2, x2 - x1, y2 - y1\n",
"x = x/4000\n",
"w = w/4000\n",
"y = y/3000\n",
"h = h/3000\n",
"print(x,y,w,h)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "an integer is required (got type tuple)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-26-0df07de4eb7b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mw\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m148\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m4000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m114\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m4000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m101\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m3000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m# cv2.rectangle(img,(x,y),(x+w,y+h), (0, 255, 0), 2)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrectangle\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimg\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mw\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mh\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m255\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\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 6\u001b[0m \u001b[0;31m# img = cv2.resize(img,(400,500))\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mcv2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'mapped.jpg'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mimg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: an integer is required (got type tuple)"
]
}
],
"source": [
"img = cv2.imread('Dataset1-annotations/auto1\\DJI_0001.JPG')\n",
"# x,y,w,h = 148,0, 114, 101\n",
"x,y,w,h = 148/4000, 0, 114/4000, 101/3000\n",
"# cv2.rectangle(img,(x,y),(x+w,y+h), (0, 255, 0), 2)\n",
"cv2.rectangle(img,(x,y),(w,h), (0, 255, 0), 2)\n",
"# img = cv2.resize(img,(400,500))\n",
"cv2.imwrite('mapped.jpg',img)\n",
"cv2.imshow('abc', img)\n",
"cv2.waitKey(0)\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### convert all annotations to yolo format"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Dataset1-annotations/auto1\\\\DJI_0001.JPG',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0002.JPG',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0005.JPG',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0006.JPG',\n",
" 'Dataset1-annotations/auto1\\\\DJI_0011.JPG']"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"imgFiles = glob('Dataset1-annotations/*.JPG')\n",
"imgFiles[:5]"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [],
"source": [
"from pdb import set_trace"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto3\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto1\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto2\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto4\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto5\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto6\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n",
"Dataset1-annotations/auto7\\DJ-done\n"
]
}
],
"source": [
"for tF,imgF in zip(txtFiles,imgFiles):\n",
" \n",
" with open(tF,'r') as f:\n",
"# set_trace()\n",
" content = f.readlines()\n",
"\n",
" curImg = cv2.imread(imgF)\n",
" imgW = int( curImg.shape[1] )\n",
" imgH = int( curImg.shape[0] )\n",
" \n",
" tempData = []\n",
" for line in content:\n",
" \n",
" x1,y1,wp,hp = list( map(lambda x:int(x), line.split()[1:] ) )\n",
" \n",
" #wp=widht paper\n",
" #convert papers w,h to x2,y2\n",
" x2, y2 = (x1+wp), (y1+hp)\n",
"\n",
" x,y,w,h = (x1 + x2) / 2, (y1 + y2) / 2, x2 - x1, y2 - y1\n",
" x = x/imgW\n",
" w = w/imgW\n",
" y = y/imgH\n",
" h = h/imgH\n",
" \n",
" tempData.append( ' '.join( map( lambda x:str(x), [0,x,y,w,h] ) ) )\n",
" \n",
" with open(tF,'w') as f:\n",
" f.write( '\\n'.join( tempData ) )\n",
" \n",
" print(f'{tF[:-10]}-done')\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0 0.055875 0.8388333333333333 0.02675 0.035666666666666666'"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"' '.join( map( lambda x:str(x), [0,x,y,w,h] ) )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### data preparation for dataset2"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"data2 = []\n",
"with open('dataset2_annotation.txt','r') as f:\n",
" data2 = f.readlines()"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['image num x y w h quality id id_conf',\n",
" 'DJI_0026.JPG 1 2237 2230 48 102 0 1 1',\n",
" 'DJI_0027.JPG 1 2273 1777 37 103 0 1 1',\n",
" 'DJI_0028.JPG 6 2293 1368 36 99 0 1 1 2071 2722 61 89 0 2 1 2285 2565 55 95 0 3 1 2348 2585 89 72 0 4 1 2385 2738 52 122 0 5 1 2582 2947 54 55 1 6 1']"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data2 = list( map(lambda x:x.replace('\\t',' ').replace('\\n','').strip(), data2) )\n",
"data2[:4]"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [],
"source": [
"for d in data2[1:]:\n",
" \n",
" start = 0\n",
" content = d.split()\n",
" \n",
" singleImageData = []\n",
" fileName = f'd2-a/{ content.pop(0)[:-4] }.txt'\n",
" num = int(content.pop(0))\n",
" for _ in range( num ):\n",
" \n",
" singleImageData.append(' '.join( [ str(0), *content[start:start+4] ] ) )\n",
"# set_trace()\n",
" start += 7\n",
" \n",
" if num > 0:\n",
" with open(fileName, 'w') as f:\n",
" f.write('\\n'.join( singleImageData ) )\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['d2-a/DJI_0026.txt',\n",
" 'd2-a/DJI_0027.txt',\n",
" 'd2-a/DJI_0028.txt',\n",
" 'd2-a/DJI_0029.txt',\n",
" 'd2-a/DJI_0030.txt']"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"txtFiles2 = glob('d2-a/*')\n",
"txtFiles2[:5]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### copying image from real data to temp folder"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"d2-a/DJI_0026.JPG\n",
"d2-a/DJI_0027.JPG\n",
"d2-a/DJI_0028.JPG\n",
"d2-a/DJI_0029.JPG\n",
"d2-a/DJI_0030.JPG\n",
"d2-a/DJI_0031.JPG\n",
"d2-a/DJI_0032.JPG\n",
"d2-a/DJI_0033.JPG\n",
"d2-a/DJI_0034.JPG\n",
"d2-a/DJI_0035.JPG\n",
"d2-a/DJI_0036.JPG\n",
"d2-a/DJI_0037.JPG\n",
"d2-a/DJI_0038.JPG\n",
"d2-a/DJI_0039.JPG\n"
]
}
],
"source": [
"for f in txtFiles2:\n",
" imgFile = f.split('/')[1].split('.')[0]+'.JPG'\n",
" print( shutil.copy(f'Dataset2/{imgFile}',f'd2-a/{imgFile}') )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['d2-a/DJI_0026.JPG',\n",
" 'd2-a/DJI_0027.JPG',\n",
" 'd2-a/DJI_0028.JPG',\n",
" 'd2-a/DJI_0029.JPG',\n",
" 'd2-a/DJI_0030.JPG']"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"imgFiles2 = glob('d2-a/*.JPG')\n",
"imgFiles2[:5]"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n",
"d2-a/DJ-done\n"
]
}
],
"source": [
"for tF,imgF in zip(txtFiles2,imgFiles2):\n",
" \n",
" with open(tF,'r') as f:\n",
"# set_trace()\n",
" content = f.readlines()\n",
"\n",
" curImg = cv2.imread(imgF)\n",
" imgW = int( curImg.shape[1] )\n",
" imgH = int( curImg.shape[0] )\n",
" \n",
" tempData = []\n",
" for line in content:\n",
" \n",
" x1,y1,wp,hp = list( map(lambda x:int(x), line.split()[1:] ) )\n",
" \n",
" #wp=widht paper\n",
" #convert papers w,h to x2,y2\n",
" x2, y2 = (x1+wp), (y1+hp)\n",
"\n",
" x,y,w,h = (x1 + x2) / 2, (y1 + y2) / 2, x2 - x1, y2 - y1\n",
" x = x/imgW\n",
" w = w/imgW\n",
" y = y/imgH\n",
" h = h/imgH\n",
" \n",
" tempData.append( ' '.join( map( lambda x:str(x), [0,x,y,w,h] ) ) )\n",
" \n",
" with open(tF,'w') as f:\n",
" f.write( '\\n'.join( tempData ) )\n",
" \n",
" print(f'{tF[:-10]}-done')\n",
" "
]
},
{
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
paper link
https://www.tandfonline.com/doi/full/10.1080/01431161.2019.1624858
dataset
http://bird.nae-lab.org/cattle/
processed data on google drive
https://drive.google.com/drive/folders/1P56xoO4hI1Ca36na1vIdf_BIvs6_Qtb9?usp=sharing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment