Move code into different folder for packaging
@ -8,8 +8,8 @@ import albumentations as A
|
||||
from torchvision import transforms, ops
|
||||
from albumentations.pytorch import ToTensorV2
|
||||
|
||||
from code.utils.conversions import scale_bboxes
|
||||
from code.utils.manipulations import get_cutout
|
||||
from utils.conversions import scale_bboxes
|
||||
from utils.manipulations import get_cutout
|
||||
|
||||
def detect(img_path: str, yolo_path: str, resnet_path: str):
|
||||
"""Load an image, detect individual plants and label them as
|
||||
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 1,
|
||||
"id": "3fe8177c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@ -14,18 +14,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 2,
|
||||
"id": "32f0f8ec",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"name = \"dataset-small\"\n",
|
||||
"dataset_dir = \"/home/zenon/Documents/master-thesis/evaluation/dataset-small\""
|
||||
"name = \"dataset\"\n",
|
||||
"dataset_dir = \"dataset\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 3,
|
||||
"id": "6343aa55",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -33,7 +33,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" 100% |█████████████████| 401/401 [633.3ms elapsed, 0s remaining, 633.2 samples/s] \n"
|
||||
" 100% |█████████████████| 640/640 [716.7ms elapsed, 0s remaining, 894.6 samples/s] \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -51,13 +51,12 @@
|
||||
" tags=split,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"classes = dataset.default_classes\n",
|
||||
"predictions_view = dataset.view()"
|
||||
"classes = dataset.default_classes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"id": "29827e3f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -65,14 +64,14 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" 100% |█████████████████| 401/401 [5.4m elapsed, 0s remaining, 1.4 samples/s] \n"
|
||||
" 100% |█████████████████| 640/640 [8.8m elapsed, 0s remaining, 1.5 samples/s] \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Do detections with model and save bounding boxes\n",
|
||||
"with fo.ProgressBar() as pb:\n",
|
||||
" for sample in pb(predictions_view):\n",
|
||||
" for sample in pb(dataset.view()):\n",
|
||||
" image = Image.open(sample.filepath)\n",
|
||||
" w, h = image.size\n",
|
||||
" pred = detect(sample.filepath, '../weights/yolo.onnx', '../weights/resnet.onnx')\n",
|
||||
@ -89,10 +88,20 @@
|
||||
" bounding_box=rel_box,\n",
|
||||
" confidence=int(row['cls_conf'])))\n",
|
||||
"\n",
|
||||
" sample[\"yolo_resnet\"] = fo.Detections(detections=detections)\n",
|
||||
" sample[\"predictions\"] = fo.Detections(detections=detections)\n",
|
||||
" sample.save()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "06e1b4c0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"dataset.persistent = True"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
@ -104,15 +113,15 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Evaluating detections...\n",
|
||||
" 100% |█████████████████| 401/401 [1.2s elapsed, 0s remaining, 339.9 samples/s] \n",
|
||||
" 100% |█████████████████| 640/640 [2.0s elapsed, 0s remaining, 319.5 samples/s] \n",
|
||||
"Performing IoU sweep...\n",
|
||||
" 100% |█████████████████| 401/401 [1.4s elapsed, 0s remaining, 288.5 samples/s] \n"
|
||||
" 100% |█████████████████| 640/640 [2.1s elapsed, 0s remaining, 297.3 samples/s] \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"results = predictions_view.evaluate_detections(\n",
|
||||
" \"yolo_resnet\",\n",
|
||||
"results = dataset.view().evaluate_detections(\n",
|
||||
" \"predictions\",\n",
|
||||
" gt_field=\"ground_truth\",\n",
|
||||
" eval_key=\"eval\",\n",
|
||||
" compute_mAP=True,\n",
|
||||
@ -121,7 +130,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 7,
|
||||
"id": "b180420b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -131,14 +140,14 @@
|
||||
"text": [
|
||||
" precision recall f1-score support\n",
|
||||
"\n",
|
||||
" Healthy 0.80 0.81 0.81 430\n",
|
||||
" Stressed 0.77 0.72 0.75 315\n",
|
||||
" Healthy 0.82 0.74 0.78 662\n",
|
||||
" Stressed 0.71 0.78 0.74 488\n",
|
||||
"\n",
|
||||
" micro avg 0.79 0.77 0.78 745\n",
|
||||
" macro avg 0.79 0.77 0.78 745\n",
|
||||
"weighted avg 0.79 0.77 0.78 745\n",
|
||||
" micro avg 0.77 0.76 0.76 1150\n",
|
||||
" macro avg 0.77 0.76 0.76 1150\n",
|
||||
"weighted avg 0.77 0.76 0.77 1150\n",
|
||||
"\n",
|
||||
"0.6336217415940075\n"
|
||||
"0.6225828327927432\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -158,7 +167,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "8e819dea581e48d69877fb551a949e49",
|
||||
"model_id": "0e0a5d23d3f148419bd62ecf4a07dce9",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@ -167,7 +176,7 @@
|
||||
" 'data': [{'mode': 'markers',\n",
|
||||
" 'opacity': 0.1,\n",
|
||||
" 'type': 'scatter',\n",
|
||||
" 'uid': '918e4315-b093-4d2b-8af4-789b5a5d5152',\n",
|
||||
" 'uid': 'c432eebe-8bf5-4b15-834c-abdc3af7c18b',\n",
|
||||
" 'x': array([0, 1, 2, 0, 1, 2, 0, 1, 2]),\n",
|
||||
" 'y': array([0, 0, 0, 1, 1, 1, 2, 2, 2])},\n",
|
||||
" {'colorscale': [[0.0, 'rgb(255,245,235)'], [0.125,\n",
|
||||
@ -178,11 +187,11 @@
|
||||
" 'hoverinfo': 'skip',\n",
|
||||
" 'showscale': False,\n",
|
||||
" 'type': 'heatmap',\n",
|
||||
" 'uid': 'c2b76e66-be9d-4ca2-9060-d350e1d5e030',\n",
|
||||
" 'z': array([[ 86, 68, 0],\n",
|
||||
" [ 0, 228, 87],\n",
|
||||
" [348, 0, 82]]),\n",
|
||||
" 'zmax': 348,\n",
|
||||
" 'uid': '01498ed3-dbe3-4c9e-baf9-49d814522d20',\n",
|
||||
" 'z': array([[105, 158, 0],\n",
|
||||
" [ 0, 382, 106],\n",
|
||||
" [493, 0, 169]]),\n",
|
||||
" 'zmax': 493,\n",
|
||||
" 'zmin': 0},\n",
|
||||
" {'colorbar': {'len': 1, 'lenmode': 'fraction'},\n",
|
||||
" 'colorscale': [[0.0, 'rgb(255,245,235)'], [0.125,\n",
|
||||
@ -193,11 +202,11 @@
|
||||
" 'hovertemplate': '<b>count: %{z}</b><br>truth: %{y}<br>predicted: %{x}<extra></extra>',\n",
|
||||
" 'opacity': 0.25,\n",
|
||||
" 'type': 'heatmap',\n",
|
||||
" 'uid': 'faa2cc05-e7dd-41df-8b22-533e4ae70f67',\n",
|
||||
" 'z': array([[ 86, 68, 0],\n",
|
||||
" [ 0, 228, 87],\n",
|
||||
" [348, 0, 82]]),\n",
|
||||
" 'zmax': 348,\n",
|
||||
" 'uid': '10618ef9-35c5-451a-b915-32b70d7bfb5e',\n",
|
||||
" 'z': array([[105, 158, 0],\n",
|
||||
" [ 0, 382, 106],\n",
|
||||
" [493, 0, 169]]),\n",
|
||||
" 'zmax': 493,\n",
|
||||
" 'zmin': 0}],\n",
|
||||
" 'layout': {'clickmode': 'event',\n",
|
||||
" 'margin': {'b': 0, 'l': 0, 'r': 0, 't': 30},\n",
|
||||
@ -238,25 +247,25 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "34fe31e66ebc452aba7202b9d206dee8",
|
||||
"model_id": "915261c4504943ec9b07813fbe75b8c9",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"FigureWidget({\n",
|
||||
" 'data': [{'customdata': array([99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 98. ,\n",
|
||||
" 98. , 98. , 97. , 97. , 97. , 97. , 97. , 96. , 96. , 95. , 94.2, 94. ,\n",
|
||||
" 93.2, 93. , 92.9, 91.9, 91.2, 91. , 91. , 90.8, 89.8, 88.8, 88. , 87.9,\n",
|
||||
" 87. , 86.9, 86. , 85.9, 85.8, 85. , 84.8, 84.6, 83.1, 81.9, 81.8, 81.1,\n",
|
||||
" 80.1, 79.9, 79.7, 78.9, 78.6, 77.9, 77.7, 76.8, 76. , 75.6, 74.6, 74.2,\n",
|
||||
" 73.3, 71.9, 70.7, 69.5, 68.3, 67.1, 66.2, 65.1, 64. , 62.9, 61.2, 60.6,\n",
|
||||
" 59.7, 58.9, 52.6, 51.1, 49.4, 47.2, 46.4, 40.7, 30.5, 0. , 0. , 0. ,\n",
|
||||
" 'data': [{'customdata': array([99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 98.8,\n",
|
||||
" 98. , 98. , 97.7, 97. , 97. , 97. , 96.9, 96.4, 96. , 95.7, 94.8, 94.3,\n",
|
||||
" 93.8, 92.8, 92.2, 91.5, 90.9, 90.7, 89.3, 88.3, 87.8, 87.1, 86.8, 86.3,\n",
|
||||
" 85.8, 85.1, 84.6, 84.1, 83.2, 82. , 81.7, 80.8, 79.7, 79.4, 78.6, 77.8,\n",
|
||||
" 77.4, 76.3, 75.5, 74.6, 73.6, 72.3, 71. , 69.9, 68.6, 67.5, 66.4, 65.4,\n",
|
||||
" 64.3, 63.2, 62.2, 61. , 60.2, 59.1, 58.1, 56.9, 50.4, 49. , 47.3, 46.4,\n",
|
||||
" 40.8, 25.3, 10. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. ]),\n",
|
||||
" 'hovertemplate': ('<b>class: %{text}</b><br>recal' ... 'customdata:.3f}<extra></extra>'),\n",
|
||||
" 'line': {'color': '#3366CC'},\n",
|
||||
" 'mode': 'lines',\n",
|
||||
" 'name': 'Healthy (AP = 0.674)',\n",
|
||||
" 'name': 'Healthy (AP = 0.631)',\n",
|
||||
" 'text': array(['Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy',\n",
|
||||
" 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy',\n",
|
||||
" 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy',\n",
|
||||
@ -275,7 +284,7 @@
|
||||
" 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy',\n",
|
||||
" 'Healthy', 'Healthy', 'Healthy', 'Healthy', 'Healthy'], dtype='<U7'),\n",
|
||||
" 'type': 'scatter',\n",
|
||||
" 'uid': 'd6dc6ac2-c3a1-43b9-b14d-01413e1e7632',\n",
|
||||
" 'uid': '7d365acd-11ac-471f-95c1-0c45b4af1e64',\n",
|
||||
" 'x': array([0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 , 0.11,\n",
|
||||
" 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 , 0.21, 0.22, 0.23,\n",
|
||||
" 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 , 0.31, 0.32, 0.33, 0.34, 0.35,\n",
|
||||
@ -286,35 +295,35 @@
|
||||
" 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 , 0.91, 0.92, 0.93, 0.94, 0.95,\n",
|
||||
" 0.96, 0.97, 0.98, 0.99, 1. ]),\n",
|
||||
" 'y': array([1. , 1. , 1. , 1. , 1. , 1. ,\n",
|
||||
" 1. , 1. , 1. , 1. , 1. , 0.85754476,\n",
|
||||
" 0.85754476, 0.85754476, 0.85652174, 0.85652174, 0.85652174, 0.85652174,\n",
|
||||
" 0.85652174, 0.8552381 , 0.8552381 , 0.84579977, 0.84120361, 0.84120361,\n",
|
||||
" 0.84117934, 0.84088811, 0.84055957, 0.8403906 , 0.8403906 , 0.8403906 ,\n",
|
||||
" 0.8403906 , 0.83984171, 0.83723176, 0.83723176, 0.83723176, 0.83723176,\n",
|
||||
" 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176,\n",
|
||||
" 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176,\n",
|
||||
" 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176, 0.83723176,\n",
|
||||
" 0.83582796, 0.83582796, 0.82701581, 0.82393714, 0.82266455, 0.82228338,\n",
|
||||
" 0.82013382, 0.81047308, 0.80513656, 0.79904708, 0.7964512 , 0.79508638,\n",
|
||||
" 0.79508638, 0.79508638, 0.79508638, 0.79484633, 0.79432749, 0.79432749,\n",
|
||||
" 0.79432749, 0.79432749, 0.72013715, 0.71985239, 0.7197879 , 0.71911422,\n",
|
||||
" 0.71911422, 0.64047365, 0.48219373, 0. , 0. , 0. ,\n",
|
||||
" 1. , 1. , 1. , 1. , 1. , 0.97197452,\n",
|
||||
" 0.88968238, 0.88968238, 0.88968238, 0.88968238, 0.88968238, 0.88968238,\n",
|
||||
" 0.88968238, 0.88962774, 0.88906313, 0.88406656, 0.87159671, 0.86864529,\n",
|
||||
" 0.86658584, 0.86482334, 0.86414826, 0.86302011, 0.86087578, 0.8598177 ,\n",
|
||||
" 0.85442276, 0.84805184, 0.84805184, 0.84805184, 0.84805184, 0.84805184,\n",
|
||||
" 0.84805184, 0.84805184, 0.84805184, 0.84805184, 0.84805184, 0.84805184,\n",
|
||||
" 0.84805184, 0.84805184, 0.84805184, 0.84805184, 0.84805184, 0.84727236,\n",
|
||||
" 0.84615682, 0.84387252, 0.84024854, 0.83876528, 0.8378955 , 0.83308277,\n",
|
||||
" 0.82724578, 0.82424648, 0.82113648, 0.8193439 , 0.81764747, 0.81764747,\n",
|
||||
" 0.81764747, 0.81716972, 0.81710833, 0.8164769 , 0.81554506, 0.81418573,\n",
|
||||
" 0.81247877, 0.81064826, 0.73478697, 0.73331137, 0.73195383, 0.73122457,\n",
|
||||
" 0.65219773, 0.41090604, 0.16526846, 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. ])},\n",
|
||||
" {'customdata': array([99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 98.7, 98. ,\n",
|
||||
" 98. , 98. , 97.9, 97.7, 97. , 96.9, 96.7, 96.5, 95.9, 95.6, 94.9, 94.5,\n",
|
||||
" 94. , 93. , 91.6, 91. , 90.1, 89.3, 89. , 88.2, 87.6, 87.2, 86.5, 86.1,\n",
|
||||
" 85.4, 84.8, 84.2, 83.1, 82.4, 81.7, 80.6, 79.5, 78.9, 77.4, 76.5, 74.7,\n",
|
||||
" 74. , 73.3, 72.3, 71.7, 71. , 70.2, 69.3, 68.6, 67.8, 67.4, 66.2, 65.3,\n",
|
||||
" 64.3, 62.7, 61.6, 60.5, 54.3, 53.1, 51.9, 45.1, 38.9, 38.2, 32. , 20.8,\n",
|
||||
" 10.1, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" {'customdata': array([99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. , 99. ,\n",
|
||||
" 98. , 98. , 98. , 98. , 98. , 98. , 97.7, 97. , 97. , 96.7, 96.5, 96. ,\n",
|
||||
" 95.7, 95.7, 95.4, 94.7, 94.6, 93.6, 93.3, 92.4, 91.6, 91.1, 90.5, 90. ,\n",
|
||||
" 89.3, 88.6, 88.2, 87.4, 87.1, 86.2, 85.4, 84.9, 84. , 83.4, 82. , 81.5,\n",
|
||||
" 80.5, 79.4, 78.5, 77.5, 76.4, 75.6, 74.6, 73.7, 72.9, 71.8, 70.9, 70.2,\n",
|
||||
" 69.5, 68.5, 67.1, 66.6, 65.5, 63.8, 62.3, 61.1, 60.1, 53.5, 52.6, 51.2,\n",
|
||||
" 45. , 43.9, 38.2, 37.4, 31.3, 25.5, 10. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. ]),\n",
|
||||
" 'hovertemplate': ('<b>class: %{text}</b><br>recal' ... 'customdata:.3f}<extra></extra>'),\n",
|
||||
" 'line': {'color': '#DC3912'},\n",
|
||||
" 'mode': 'lines',\n",
|
||||
" 'name': 'Stressed (AP = 0.593)',\n",
|
||||
" 'name': 'Stressed (AP = 0.614)',\n",
|
||||
" 'text': array(['Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed',\n",
|
||||
" 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed',\n",
|
||||
" 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed',\n",
|
||||
@ -333,7 +342,7 @@
|
||||
" 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed',\n",
|
||||
" 'Stressed', 'Stressed', 'Stressed', 'Stressed', 'Stressed'], dtype='<U8'),\n",
|
||||
" 'type': 'scatter',\n",
|
||||
" 'uid': '01082c55-ea56-426c-8cfb-a433926eed03',\n",
|
||||
" 'uid': 'c00a4fd2-8937-4000-bfbe-6429b1528d2d',\n",
|
||||
" 'x': array([0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 , 0.11,\n",
|
||||
" 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 , 0.21, 0.22, 0.23,\n",
|
||||
" 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 , 0.31, 0.32, 0.33, 0.34, 0.35,\n",
|
||||
@ -344,19 +353,19 @@
|
||||
" 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 , 0.91, 0.92, 0.93, 0.94, 0.95,\n",
|
||||
" 0.96, 0.97, 0.98, 0.99, 1. ]),\n",
|
||||
" 'y': array([1. , 1. , 1. , 1. , 1. , 1. ,\n",
|
||||
" 1. , 1. , 1. , 1. , 0.97379592, 0.94476123,\n",
|
||||
" 0.94476123, 0.94476123, 0.93427565, 0.91445476, 0.85844913, 0.85844913,\n",
|
||||
" 0.85790639, 0.85788924, 0.85788924, 0.85747126, 0.85663314, 0.85452586,\n",
|
||||
" 0.85298487, 0.84306319, 0.8375 , 0.8375 , 0.8375 , 0.8375 ,\n",
|
||||
" 0.8375 , 0.8375 , 0.8375 , 0.8375 , 0.8375 , 0.8375 ,\n",
|
||||
" 0.83717347, 0.83658868, 0.83565817, 0.8336283 , 0.82847628, 0.82488659,\n",
|
||||
" 0.82126275, 0.8175916 , 0.81473127, 0.80427951, 0.8016311 , 0.80115198,\n",
|
||||
" 0.8008129 , 0.80053685, 0.79883857, 0.79853619, 0.79853619, 0.79782171,\n",
|
||||
" 0.79757033, 0.79595576, 0.79417872, 0.79338307, 0.79116989, 0.78813658,\n",
|
||||
" 0.78474129, 0.78273994, 0.77996131, 0.77679573, 0.70534431, 0.70114991,\n",
|
||||
" 0.69945778, 0.62345091, 0.54988677, 0.54689953, 0.46774707, 0.31001791,\n",
|
||||
" 0.1547619 , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 1. , 1. , 1. , 1. , 1. , 1. ,\n",
|
||||
" 0.91667218, 0.91667218, 0.91667218, 0.91667218, 0.91667218, 0.91667218,\n",
|
||||
" 0.89886256, 0.8706589 , 0.8706589 , 0.86176273, 0.8566061 , 0.8426063 ,\n",
|
||||
" 0.8414663 , 0.8414663 , 0.8414663 , 0.83779842, 0.83730636, 0.82590162,\n",
|
||||
" 0.82226179, 0.81571494, 0.80136981, 0.79562115, 0.79030661, 0.78516763,\n",
|
||||
" 0.77779393, 0.77779393, 0.7766316 , 0.77013304, 0.76981741, 0.7687736 ,\n",
|
||||
" 0.76706332, 0.76615004, 0.76345747, 0.76120645, 0.75633043, 0.75442522,\n",
|
||||
" 0.75216493, 0.74937749, 0.74462707, 0.73753607, 0.73544297, 0.73534102,\n",
|
||||
" 0.73534102, 0.73491603, 0.73330167, 0.73209432, 0.73192653, 0.73073596,\n",
|
||||
" 0.7298439 , 0.72819654, 0.72615935, 0.72491458, 0.72298246, 0.71613728,\n",
|
||||
" 0.71363144, 0.71260932, 0.71076601, 0.64219247, 0.63885976, 0.636554 ,\n",
|
||||
" 0.57072089, 0.56905625, 0.49989485, 0.4972456 , 0.42550943, 0.35394558,\n",
|
||||
" 0.14235075, 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. , 0. ,\n",
|
||||
" 0. , 0. , 0. , 0. , 0. ])}],\n",
|
||||
@ -377,12 +386,8 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Get the 10 most common classes in the dataset\n",
|
||||
"counts = dataset.count_values(\"ground_truth.detections.label\")\n",
|
||||
"classes_top10 = sorted(counts, key=counts.get, reverse=True)\n",
|
||||
"\n",
|
||||
"# Print a classification report for the top-10 classes\n",
|
||||
"results.print_report(classes=classes_top10)\n",
|
||||
"# Print a classification report for all classes\n",
|
||||
"results.print_report()\n",
|
||||
"\n",
|
||||
"print(results.mAP())\n",
|
||||
"\n",
|
||||
@ -390,13 +395,13 @@
|
||||
"matrix = results.plot_confusion_matrix(classes=classes)\n",
|
||||
"matrix.show()\n",
|
||||
"\n",
|
||||
"pr_curves = results.plot_pr_curves(classes=[\"Healthy\", \"Stressed\"])\n",
|
||||
"pr_curves = results.plot_pr_curves(classes=classes)\n",
|
||||
"pr_curves.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 8,
|
||||
"id": "d1137788",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -422,24 +427,50 @@
|
||||
],
|
||||
"source": [
|
||||
"session = fo.launch_app(dataset, auto=False)\n",
|
||||
"session.view = predictions_view\n",
|
||||
"session.view = dataset.view()\n",
|
||||
"session.plots.attach(matrix)\n",
|
||||
"session.open_tab()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"id": "535003f4",
|
||||
"execution_count": 9,
|
||||
"id": "6eed9a86",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"session.plots.attach(matrix)"
|
||||
"def export_dataset(dataset, export_dir):\n",
|
||||
" label_field = \"ground_truth\"\n",
|
||||
"\n",
|
||||
" # The splits to export\n",
|
||||
" splits = [\"val\"]\n",
|
||||
"\n",
|
||||
" classes = [\"Healthy\", \"Stressed\"]\n",
|
||||
"\n",
|
||||
" # Export the splits\n",
|
||||
" for split in splits:\n",
|
||||
" split_view = dataset.match_tags(split)\n",
|
||||
" split_view.export(\n",
|
||||
" export_dir=export_dir,\n",
|
||||
" dataset_type=fo.types.YOLOv5Dataset,\n",
|
||||
" label_field=label_field,\n",
|
||||
" split=split,\n",
|
||||
" classes=classes,\n",
|
||||
" )"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d3ba32f0",
|
||||
"id": "19c5b271",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ebdde519",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@ -1,9 +1,9 @@
|
||||
import fiftyone as fo
|
||||
from PIL import Image
|
||||
from code.evaluation.detection import detect
|
||||
from detection import detect
|
||||
|
||||
name = "dataset-small"
|
||||
dataset_dir = "/home/zenon/Documents/master-thesis/evaluation/dataset-small"
|
||||
dataset_dir = "/home/zenon/Documents/master-thesis/classification/evaluation/dataset-small"
|
||||
|
||||
# The splits to load
|
||||
splits = ["val"]
|
||||
@ -4,8 +4,8 @@ import cv2
|
||||
import json
|
||||
import os
|
||||
|
||||
from code.utils.conversions import convert_to_yolo
|
||||
from code.evaluation.detection import detect
|
||||
from utils.conversions import convert_to_yolo
|
||||
from detection import detect
|
||||
|
||||
template = [{
|
||||
"data": {
|
||||
8
classification/setup.py
Normal file
@ -0,0 +1,8 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(name='thesis',
|
||||
version='0.1.0',
|
||||
author='Tobias Eidelpes',
|
||||
author_email='e1527193@student.tuwien.ac.at',
|
||||
packages=find_packages(),
|
||||
description='Flower State Classification')
|
||||
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 243 KiB After Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 249 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 249 KiB After Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 303 KiB |
|
Before Width: | Height: | Size: 349 KiB After Width: | Height: | Size: 349 KiB |
|
Before Width: | Height: | Size: 355 KiB After Width: | Height: | Size: 355 KiB |
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 357 KiB |
|
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 334 KiB After Width: | Height: | Size: 334 KiB |
|
Before Width: | Height: | Size: 330 KiB After Width: | Height: | Size: 330 KiB |
|
Before Width: | Height: | Size: 345 KiB After Width: | Height: | Size: 345 KiB |
|
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 357 KiB |
@ -1,169 +0,0 @@
|
||||
import argparse
|
||||
import cv2
|
||||
import torch
|
||||
from torchvision import transforms
|
||||
|
||||
|
||||
def load_models(yolo_path: str, resnet_path: str):
|
||||
"""Load the models for two-stage classification.
|
||||
|
||||
:param str yolo_path: path to yolo weights
|
||||
:param str resnet_path: path to resnet weights
|
||||
:returns: tuple of models
|
||||
|
||||
"""
|
||||
first_stage = torch.hub.load("WongKinYiu/yolov7",
|
||||
"custom",
|
||||
yolo_path,
|
||||
trust_repo=True)
|
||||
second_stage = torch.load(resnet_path)
|
||||
return (first_stage, second_stage)
|
||||
|
||||
|
||||
def detect(img_path: str, yolo_path: str, resnet_path: str):
|
||||
"""Load an image, detect individual plants and label them as
|
||||
healthy or wilted.
|
||||
|
||||
:param str img_path: path to image
|
||||
:param str yolo_path: path to yolo weights
|
||||
:param str resnet_path: path to resnet weights
|
||||
:returns: tuple of recent image and dict of bounding boxes and
|
||||
their predictions
|
||||
|
||||
"""
|
||||
img = cv2.imread(img_path)
|
||||
original = img.copy()
|
||||
(first_stage, second_stage) = load_models(yolo_path, resnet_path)
|
||||
|
||||
# Get bounding boxes from object detection model
|
||||
box_coords = get_boxes(first_stage, img)
|
||||
|
||||
box_coords.sort_values(by=['xmin'], ignore_index=True, inplace=True)
|
||||
print(box_coords)
|
||||
|
||||
predictions = {}
|
||||
for idx, row in box_coords.iterrows():
|
||||
xmin, xmax = int(row['xmin']), int(row['xmax'])
|
||||
ymin, ymax = int(row['ymin']), int(row['ymax'])
|
||||
|
||||
# Get tensor of ROI in BGR
|
||||
cropped_image = get_cutout(img.copy(), xmin, xmax, ymin, ymax)
|
||||
|
||||
# Classify ROI in RGB
|
||||
predictions[idx] = classify(second_stage, cropped_image[..., ::-1])
|
||||
|
||||
# Draw bounding box and number on original image
|
||||
original = cv2.rectangle(original, (xmin, ymin), (xmax, ymax),
|
||||
(0, 255, 0), 2)
|
||||
original = cv2.putText(original, str(idx), (xmin + 5, ymin + 25),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 0), 4,
|
||||
cv2.LINE_AA)
|
||||
original = cv2.putText(original, str(idx), (xmin + 5, ymin + 25),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 0.9, (255, 255, 255),
|
||||
2, cv2.LINE_AA)
|
||||
|
||||
cv2.imshow('original', original)
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows()
|
||||
return (original, predictions)
|
||||
|
||||
|
||||
def get_boxes(model, img):
|
||||
"""Run object detection model on an image and get the bounding box
|
||||
coordinates of all matches.
|
||||
|
||||
:param model: object detection model (YOLO)
|
||||
:param img: opencv2 image object
|
||||
:returns: pandas dataframe of matches
|
||||
|
||||
"""
|
||||
with torch.no_grad():
|
||||
box_coords = model(img[..., ::-1], size=640)
|
||||
return box_coords.pandas().xyxy[0]
|
||||
|
||||
|
||||
def classify(model, img):
|
||||
"""Classify img with object classification model.
|
||||
|
||||
:param model: object classification model
|
||||
:param img: opencv2 image object in RGB
|
||||
:returns: tensor of class predictions
|
||||
|
||||
"""
|
||||
# Transform image for ResNet
|
||||
data_transforms = transforms.Compose([
|
||||
transforms.ToTensor(),
|
||||
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
|
||||
])
|
||||
|
||||
img = data_transforms(img.copy())
|
||||
with torch.no_grad():
|
||||
out = model(img.unsqueeze(0))
|
||||
# Apply softmax to get percentage confidence of classes
|
||||
out = torch.nn.functional.softmax(out, dim=1)[0] * 100
|
||||
return out
|
||||
|
||||
|
||||
def get_cutout(img, xmin, xmax, ymin, ymax):
|
||||
"""Cut out a bounding box from an image and transform it for
|
||||
object classification model.
|
||||
|
||||
:param img: opencv2 image object in BGR
|
||||
:param int xmin: start of bounding box on x axis
|
||||
:param int xmax: end of bounding box on x axis
|
||||
:param int ymin: start of bounding box on y axis
|
||||
:param int ymax: end of bounding box on y axis
|
||||
:returns: tensor of cropped image in BGR
|
||||
|
||||
"""
|
||||
cropped_image = img[ymin:ymax, xmin:xmax]
|
||||
return cropped_image
|
||||
|
||||
|
||||
def export_to_onnx(yolo_path: str, resnet_path: str):
|
||||
"""Export the models to onnx.
|
||||
|
||||
:param yolo_path: path to yolo weights
|
||||
:param resnet_path: path to resnet weights
|
||||
:returns: None
|
||||
|
||||
"""
|
||||
(first, second) = load_models(yolo_path, resnet_path)
|
||||
first.eval()
|
||||
second.eval()
|
||||
|
||||
first_x = torch.randn((1, 3, 640, 640), requires_grad=True)
|
||||
second_x = torch.randn((1, 3, 224, 224), requires_grad=True)
|
||||
|
||||
torch.onnx.export(first,
|
||||
first_x,
|
||||
'yolo.onnx',
|
||||
export_params=True,
|
||||
do_constant_folding=True,
|
||||
input_names=['input'],
|
||||
output_names=['output'])
|
||||
|
||||
torch.onnx.export(second,
|
||||
second_x,
|
||||
'resnet.onnx',
|
||||
export_params=True,
|
||||
do_constant_folding=True,
|
||||
input_names=['input'],
|
||||
output_names=['output'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--source', type=str, help='image file or webcam')
|
||||
parser.add_argument('--onnx',
|
||||
action='store_true',
|
||||
dest='onnx',
|
||||
help='export models to onnx')
|
||||
opt = parser.parse_args()
|
||||
|
||||
if opt.source:
|
||||
detect(opt.source, 'yolo.pt', 'resnet.pt')
|
||||
if opt.onnx:
|
||||
export_to_onnx('yolo.pt', 'resnet.pt')
|
||||
|
||||
|
||||
263
code/training/yolov7/.gitignore
vendored
@ -1,263 +0,0 @@
|
||||
# Repo-specific GitIgnore ----------------------------------------------------------------------------------------------
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.png
|
||||
*.bmp
|
||||
*.tif
|
||||
*.tiff
|
||||
*.heic
|
||||
*.JPG
|
||||
*.JPEG
|
||||
*.PNG
|
||||
*.BMP
|
||||
*.TIF
|
||||
*.TIFF
|
||||
*.HEIC
|
||||
*.mp4
|
||||
*.mov
|
||||
*.MOV
|
||||
*.avi
|
||||
*.data
|
||||
*.json
|
||||
*.cfg
|
||||
!setup.cfg
|
||||
!cfg/yolov3*.cfg
|
||||
|
||||
storage.googleapis.com
|
||||
runs/*
|
||||
data/*
|
||||
data/images/*
|
||||
!data/*.yaml
|
||||
!data/hyps
|
||||
!data/scripts
|
||||
!data/images
|
||||
!data/images/zidane.jpg
|
||||
!data/images/bus.jpg
|
||||
!data/*.sh
|
||||
|
||||
results*.csv
|
||||
|
||||
# Datasets -------------------------------------------------------------------------------------------------------------
|
||||
coco/
|
||||
coco128/
|
||||
VOC/
|
||||
|
||||
coco2017labels-segments.zip
|
||||
test2017.zip
|
||||
train2017.zip
|
||||
val2017.zip
|
||||
|
||||
# MATLAB GitIgnore -----------------------------------------------------------------------------------------------------
|
||||
*.m~
|
||||
*.mat
|
||||
!targets*.mat
|
||||
|
||||
# Neural Network weights -----------------------------------------------------------------------------------------------
|
||||
*.weights
|
||||
*.pt
|
||||
*.pb
|
||||
*.onnx
|
||||
*.engine
|
||||
*.mlmodel
|
||||
*.torchscript
|
||||
*.tflite
|
||||
*.h5
|
||||
*_saved_model/
|
||||
*_web_model/
|
||||
*_openvino_model/
|
||||
darknet53.conv.74
|
||||
yolov3-tiny.conv.15
|
||||
*.ptl
|
||||
*.trt
|
||||
|
||||
# GitHub Python GitIgnore ----------------------------------------------------------------------------------------------
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
/wandb/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# dotenv
|
||||
.env
|
||||
|
||||
# virtualenv
|
||||
.venv*
|
||||
venv*/
|
||||
ENV*/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
|
||||
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -----------------------------------------------
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
Icon?
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
|
||||
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff:
|
||||
.idea/*
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
.html # Bokeh Plots
|
||||
.pg # TensorFlow Frozen Graphs
|
||||
.avi # videos
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# CMake
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@ -1,279 +0,0 @@
|
||||
# Official YOLOv7
|
||||
|
||||
Implementation of paper - [YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors](https://arxiv.org/abs/2207.02696)
|
||||
|
||||
[](https://paperswithcode.com/sota/real-time-object-detection-on-coco?p=yolov7-trainable-bag-of-freebies-sets-new)
|
||||
[](https://huggingface.co/spaces/akhaliq/yolov7)
|
||||
<a href="https://colab.research.google.com/gist/AlexeyAB/b769f5795e65fdab80086f6cb7940dae/yolov7detection.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||
[](https://arxiv.org/abs/2207.02696)
|
||||
|
||||
<div align="center">
|
||||
<a href="./">
|
||||
<img src="./figure/performance.png" width="79%"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
## Web Demo
|
||||
|
||||
- Integrated into [Huggingface Spaces 🤗](https://huggingface.co/spaces/akhaliq/yolov7) using Gradio. Try out the Web Demo [](https://huggingface.co/spaces/akhaliq/yolov7)
|
||||
|
||||
## Performance
|
||||
|
||||
MS COCO
|
||||
|
||||
| Model | Test Size | AP<sup>test</sup> | AP<sub>50</sub><sup>test</sup> | AP<sub>75</sub><sup>test</sup> | batch 1 fps | batch 32 average time |
|
||||
| :-- | :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| [**YOLOv7**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) | 640 | **51.4%** | **69.7%** | **55.9%** | 161 *fps* | 2.8 *ms* |
|
||||
| [**YOLOv7-X**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pt) | 640 | **53.1%** | **71.2%** | **57.8%** | 114 *fps* | 4.3 *ms* |
|
||||
| | | | | | | |
|
||||
| [**YOLOv7-W6**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pt) | 1280 | **54.9%** | **72.6%** | **60.1%** | 84 *fps* | 7.6 *ms* |
|
||||
| [**YOLOv7-E6**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt) | 1280 | **56.0%** | **73.5%** | **61.2%** | 56 *fps* | 12.3 *ms* |
|
||||
| [**YOLOv7-D6**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pt) | 1280 | **56.6%** | **74.0%** | **61.8%** | 44 *fps* | 15.0 *ms* |
|
||||
| [**YOLOv7-E6E**](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt) | 1280 | **56.8%** | **74.4%** | **62.1%** | 36 *fps* | 18.7 *ms* |
|
||||
|
||||
## Installation
|
||||
|
||||
Docker environment (recommended)
|
||||
<details><summary> <b>Expand</b> </summary>
|
||||
|
||||
``` shell
|
||||
# create the docker container, you can change the share memory size if you have more.
|
||||
nvidia-docker run --name yolov7 -it -v your_coco_path/:/coco/ -v your_code_path/:/yolov7 --shm-size=64g nvcr.io/nvidia/pytorch:21.08-py3
|
||||
|
||||
# apt install required packages
|
||||
apt update
|
||||
apt install -y zip htop screen libgl1-mesa-glx
|
||||
|
||||
# pip install required packages
|
||||
pip install seaborn thop
|
||||
|
||||
# go to code folder
|
||||
cd /yolov7
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Testing
|
||||
|
||||
[`yolov7.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) [`yolov7x.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pt) [`yolov7-w6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pt) [`yolov7-e6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt) [`yolov7-d6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pt) [`yolov7-e6e.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt)
|
||||
|
||||
``` shell
|
||||
python test.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.65 --device 0 --weights yolov7.pt --name yolov7_640_val
|
||||
```
|
||||
|
||||
You will get the results:
|
||||
|
||||
```
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.51206
|
||||
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.69730
|
||||
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.55521
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.35247
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.55937
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.66693
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.38453
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.63765
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.68772
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.53766
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.73549
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.83868
|
||||
```
|
||||
|
||||
To measure accuracy, download [COCO-annotations for Pycocotools](http://images.cocodataset.org/annotations/annotations_trainval2017.zip) to the `./coco/annotations/instances_val2017.json`
|
||||
|
||||
## Training
|
||||
|
||||
Data preparation
|
||||
|
||||
``` shell
|
||||
bash scripts/get_coco.sh
|
||||
```
|
||||
|
||||
* Download MS COCO dataset images ([train](http://images.cocodataset.org/zips/train2017.zip), [val](http://images.cocodataset.org/zips/val2017.zip), [test](http://images.cocodataset.org/zips/test2017.zip)) and [labels](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/coco2017labels-segments.zip). If you have previously used a different version of YOLO, we strongly recommend that you delete `train2017.cache` and `val2017.cache` files, and redownload [labels](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/coco2017labels-segments.zip)
|
||||
|
||||
Single GPU training
|
||||
|
||||
``` shell
|
||||
# train p5 models
|
||||
python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml
|
||||
|
||||
# train p6 models
|
||||
python train_aux.py --workers 8 --device 0 --batch-size 16 --data data/coco.yaml --img 1280 1280 --cfg cfg/training/yolov7-w6.yaml --weights '' --name yolov7-w6 --hyp data/hyp.scratch.p6.yaml
|
||||
```
|
||||
|
||||
Multiple GPU training
|
||||
|
||||
``` shell
|
||||
# train p5 models
|
||||
python -m torch.distributed.launch --nproc_per_node 4 --master_port 9527 train.py --workers 8 --device 0,1,2,3 --sync-bn --batch-size 128 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml
|
||||
|
||||
# train p6 models
|
||||
python -m torch.distributed.launch --nproc_per_node 8 --master_port 9527 train_aux.py --workers 8 --device 0,1,2,3,4,5,6,7 --sync-bn --batch-size 128 --data data/coco.yaml --img 1280 1280 --cfg cfg/training/yolov7-w6.yaml --weights '' --name yolov7-w6 --hyp data/hyp.scratch.p6.yaml
|
||||
```
|
||||
|
||||
## Transfer learning
|
||||
|
||||
[`yolov7_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7_training.pt) [`yolov7x_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x_training.pt) [`yolov7-w6_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6_training.pt) [`yolov7-e6_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6_training.pt) [`yolov7-d6_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6_training.pt) [`yolov7-e6e_training.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e_training.pt)
|
||||
|
||||
Single GPU finetuning for custom dataset
|
||||
|
||||
``` shell
|
||||
# finetune p5 models
|
||||
python train.py --workers 8 --device 0 --batch-size 32 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-custom.yaml --weights 'yolov7_training.pt' --name yolov7-custom --hyp data/hyp.scratch.custom.yaml
|
||||
|
||||
# finetune p6 models
|
||||
python train_aux.py --workers 8 --device 0 --batch-size 16 --data data/custom.yaml --img 1280 1280 --cfg cfg/training/yolov7-w6-custom.yaml --weights 'yolov7-w6_training.pt' --name yolov7-w6-custom --hyp data/hyp.scratch.custom.yaml
|
||||
```
|
||||
|
||||
## Re-parameterization
|
||||
|
||||
See [reparameterization.ipynb](tools/reparameterization.ipynb)
|
||||
|
||||
## Inference
|
||||
|
||||
On video:
|
||||
``` shell
|
||||
python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source yourvideo.mp4
|
||||
```
|
||||
|
||||
On image:
|
||||
``` shell
|
||||
python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
<a href="./">
|
||||
<img src="./figure/horses_prediction.jpg" width="59%"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
## Export
|
||||
|
||||
**Pytorch to CoreML (and inference on MacOS/iOS)** <a href="https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7CoreML.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||
|
||||
**Pytorch to ONNX with NMS (and inference)** <a href="https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7onnx.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||
```shell
|
||||
python export.py --weights yolov7-tiny.pt --grid --end2end --simplify \
|
||||
--topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640 --max-wh 640
|
||||
```
|
||||
|
||||
**Pytorch to TensorRT with NMS (and inference)** <a href="https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7trt.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
||||
|
||||
```shell
|
||||
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
|
||||
python export.py --weights ./yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640
|
||||
git clone https://github.com/Linaom1214/tensorrt-python.git
|
||||
python ./tensorrt-python/export.py -o yolov7-tiny.onnx -e yolov7-tiny-nms.trt -p fp16
|
||||
```
|
||||
|
||||
**Pytorch to TensorRT another way** <a href="https://colab.research.google.com/gist/AlexeyAB/fcb47ae544cf284eb24d8ad8e880d45c/yolov7trtlinaom.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a> <details><summary> <b>Expand</b> </summary>
|
||||
|
||||
|
||||
```shell
|
||||
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
|
||||
python export.py --weights yolov7-tiny.pt --grid --include-nms
|
||||
git clone https://github.com/Linaom1214/tensorrt-python.git
|
||||
python ./tensorrt-python/export.py -o yolov7-tiny.onnx -e yolov7-tiny-nms.trt -p fp16
|
||||
|
||||
# Or use trtexec to convert ONNX to TensorRT engine
|
||||
/usr/src/tensorrt/bin/trtexec --onnx=yolov7-tiny.onnx --saveEngine=yolov7-tiny-nms.trt --fp16
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Tested with: Python 3.7.13, Pytorch 1.12.0+cu113
|
||||
|
||||
## Pose estimation
|
||||
|
||||
[`code`](https://github.com/WongKinYiu/yolov7/tree/pose) [`yolov7-w6-pose.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6-pose.pt)
|
||||
|
||||
See [keypoint.ipynb](https://github.com/WongKinYiu/yolov7/blob/main/tools/keypoint.ipynb).
|
||||
|
||||
<div align="center">
|
||||
<a href="./">
|
||||
<img src="./figure/pose.png" width="39%"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
## Instance segmentation
|
||||
|
||||
[`code`](https://github.com/WongKinYiu/yolov7/tree/mask) [`yolov7-mask.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-mask.pt)
|
||||
|
||||
See [instance.ipynb](https://github.com/WongKinYiu/yolov7/blob/main/tools/instance.ipynb).
|
||||
|
||||
<div align="center">
|
||||
<a href="./">
|
||||
<img src="./figure/mask.png" width="59%"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
## Instance segmentation
|
||||
|
||||
[`code`](https://github.com/WongKinYiu/yolov7/tree/u7/seg) [`yolov7-seg.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-seg.pt)
|
||||
|
||||
YOLOv7 for instance segmentation (YOLOR + YOLOv5 + YOLACT)
|
||||
|
||||
| Model | Test Size | AP<sup>box</sup> | AP<sub>50</sub><sup>box</sup> | AP<sub>75</sub><sup>box</sup> | AP<sup>mask</sup> | AP<sub>50</sub><sup>mask</sup> | AP<sub>75</sub><sup>mask</sup> |
|
||||
| :-- | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
|
||||
| **YOLOv7-seg** | 640 | **51.4%** | **69.4%** | **55.8%** | **41.5%** | **65.5%** | **43.7%** |
|
||||
|
||||
## Anchor free detection head
|
||||
|
||||
[`code`](https://github.com/WongKinYiu/yolov7/tree/u6) [`yolov7-u6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-u6.pt)
|
||||
|
||||
YOLOv7 with decoupled TAL head (YOLOR + YOLOv5 + YOLOv6)
|
||||
|
||||
| Model | Test Size | AP<sup>val</sup> | AP<sub>50</sub><sup>val</sup> | AP<sub>75</sub><sup>val</sup> |
|
||||
| :-- | :-: | :-: | :-: | :-: |
|
||||
| **YOLOv7-u6** | 640 | **52.6%** | **69.7%** | **57.3%** |
|
||||
|
||||
|
||||
## Citation
|
||||
|
||||
```
|
||||
@article{wang2022yolov7,
|
||||
title={{YOLOv7}: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors},
|
||||
author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
|
||||
journal={arXiv preprint arXiv:2207.02696},
|
||||
year={2022}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Teaser
|
||||
|
||||
Yolov7-semantic & YOLOv7-panoptic & YOLOv7-caption
|
||||
|
||||
<div align="center">
|
||||
<a href="./">
|
||||
<img src="./figure/tennis.jpg" width="24%"/>
|
||||
</a>
|
||||
<a href="./">
|
||||
<img src="./figure/tennis_semantic.jpg" width="24%"/>
|
||||
</a>
|
||||
<a href="./">
|
||||
<img src="./figure/tennis_panoptic.png" width="24%"/>
|
||||
</a>
|
||||
<a href="./">
|
||||
<img src="./figure/tennis_caption.png" width="24%"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
<details><summary> <b>Expand</b> </summary>
|
||||
|
||||
* [https://github.com/AlexeyAB/darknet](https://github.com/AlexeyAB/darknet)
|
||||
* [https://github.com/WongKinYiu/yolor](https://github.com/WongKinYiu/yolor)
|
||||
* [https://github.com/WongKinYiu/PyTorch_YOLOv4](https://github.com/WongKinYiu/PyTorch_YOLOv4)
|
||||
* [https://github.com/WongKinYiu/ScaledYOLOv4](https://github.com/WongKinYiu/ScaledYOLOv4)
|
||||
* [https://github.com/Megvii-BaseDetection/YOLOX](https://github.com/Megvii-BaseDetection/YOLOX)
|
||||
* [https://github.com/ultralytics/yolov3](https://github.com/ultralytics/yolov3)
|
||||
* [https://github.com/ultralytics/yolov5](https://github.com/ultralytics/yolov5)
|
||||
* [https://github.com/DingXiaoH/RepVGG](https://github.com/DingXiaoH/RepVGG)
|
||||
* [https://github.com/JUGGHM/OREPA_CVPR2022](https://github.com/JUGGHM/OREPA_CVPR2022)
|
||||
* [https://github.com/TexasInstruments/edgeai-yolov5/tree/yolo-pose](https://github.com/TexasInstruments/edgeai-yolov5/tree/yolo-pose)
|
||||
|
||||
</details>
|
||||
@ -1,49 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # model depth multiple
|
||||
width_multiple: 1.0 # layer channel multiple
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [12,16, 19,36, 40,28] # P3/8
|
||||
- [36,75, 76,55, 72,146] # P4/16
|
||||
- [142,110, 192,243, 459,401] # P5/32
|
||||
|
||||
# CSP-ResNet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, Stem, [128]], # 0-P1/2
|
||||
[-1, 3, ResCSPC, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 2-P3/8
|
||||
[-1, 4, ResCSPC, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 4-P3/8
|
||||
[-1, 6, ResCSPC, [512]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 6-P3/8
|
||||
[-1, 3, ResCSPC, [1024]], # 7
|
||||
]
|
||||
|
||||
# CSP-Res-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 8
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[5, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, ResCSPB, [256]], # 13
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[3, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, ResCSPB, [128]], # 18
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 13], 1, Concat, [1]], # cat
|
||||
[-1, 2, ResCSPB, [256]], # 22
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [512, 3, 2]],
|
||||
[[-1, 8], 1, Concat, [1]], # cat
|
||||
[-1, 2, ResCSPB, [512]], # 26
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[19,23,27], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)
|
||||
]
|
||||
@ -1,49 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # model depth multiple
|
||||
width_multiple: 1.0 # layer channel multiple
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [12,16, 19,36, 40,28] # P3/8
|
||||
- [36,75, 76,55, 72,146] # P4/16
|
||||
- [142,110, 192,243, 459,401] # P5/32
|
||||
|
||||
# CSP-ResNeXt backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, Stem, [128]], # 0-P1/2
|
||||
[-1, 3, ResXCSPC, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 2-P3/8
|
||||
[-1, 4, ResXCSPC, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 4-P3/8
|
||||
[-1, 6, ResXCSPC, [512]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 6-P3/8
|
||||
[-1, 3, ResXCSPC, [1024]], # 7
|
||||
]
|
||||
|
||||
# CSP-ResX-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 8
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[5, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, ResXCSPB, [256]], # 13
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[3, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, ResXCSPB, [128]], # 18
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 13], 1, Concat, [1]], # cat
|
||||
[-1, 2, ResXCSPB, [256]], # 22
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [512, 3, 2]],
|
||||
[[-1, 8], 1, Concat, [1]], # cat
|
||||
[-1, 2, ResXCSPB, [512]], # 26
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[19,23,27], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)
|
||||
]
|
||||
@ -1,52 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.33 # model depth multiple
|
||||
width_multiple: 1.25 # layer channel multiple
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [12,16, 19,36, 40,28] # P3/8
|
||||
- [36,75, 76,55, 72,146] # P4/16
|
||||
- [142,110, 192,243, 459,401] # P5/32
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, Conv, [32, 3, 1]], # 0
|
||||
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2
|
||||
[-1, 1, Bottleneck, [64]],
|
||||
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4
|
||||
[-1, 2, BottleneckCSPC, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8
|
||||
[-1, 8, BottleneckCSPC, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16
|
||||
[-1, 8, BottleneckCSPC, [512]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32
|
||||
[-1, 4, BottleneckCSPC, [1024]], # 10
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 11
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[8, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, BottleneckCSPB, [256]], # 16
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[6, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, BottleneckCSPB, [128]], # 21
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 16], 1, Concat, [1]], # cat
|
||||
[-1, 2, BottleneckCSPB, [256]], # 25
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [512, 3, 2]],
|
||||
[[-1, 11], 1, Concat, [1]], # cat
|
||||
[-1, 2, BottleneckCSPB, [512]], # 29
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[22,26,30], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)
|
||||
]
|
||||
@ -1,52 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # model depth multiple
|
||||
width_multiple: 1.0 # layer channel multiple
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [12,16, 19,36, 40,28] # P3/8
|
||||
- [36,75, 76,55, 72,146] # P4/16
|
||||
- [142,110, 192,243, 459,401] # P5/32
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, Conv, [32, 3, 1]], # 0
|
||||
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2
|
||||
[-1, 1, Bottleneck, [64]],
|
||||
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4
|
||||
[-1, 2, BottleneckCSPC, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8
|
||||
[-1, 8, BottleneckCSPC, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16
|
||||
[-1, 8, BottleneckCSPC, [512]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32
|
||||
[-1, 4, BottleneckCSPC, [1024]], # 10
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 11
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[8, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, BottleneckCSPB, [256]], # 16
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[6, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 2, BottleneckCSPB, [128]], # 21
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 16], 1, Concat, [1]], # cat
|
||||
[-1, 2, BottleneckCSPB, [256]], # 25
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [512, 3, 2]],
|
||||
[[-1, 11], 1, Concat, [1]], # cat
|
||||
[-1, 2, BottleneckCSPB, [512]], # 29
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[22,26,30], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5)
|
||||
]
|
||||
@ -1,63 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # expand model depth
|
||||
width_multiple: 1.25 # expand layer channels
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [ 19,27, 44,40, 38,94 ] # P3/8
|
||||
- [ 96,68, 86,152, 180,137 ] # P4/16
|
||||
- [ 140,301, 303,264, 238,542 ] # P5/32
|
||||
- [ 436,615, 739,380, 925,792 ] # P6/64
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, ReOrg, []], # 0
|
||||
[-1, 1, Conv, [64, 3, 1]], # 1-P1/2
|
||||
[-1, 1, DownC, [128]], # 2-P2/4
|
||||
[-1, 3, BottleneckCSPA, [128]],
|
||||
[-1, 1, DownC, [256]], # 4-P3/8
|
||||
[-1, 15, BottleneckCSPA, [256]],
|
||||
[-1, 1, DownC, [512]], # 6-P4/16
|
||||
[-1, 15, BottleneckCSPA, [512]],
|
||||
[-1, 1, DownC, [768]], # 8-P5/32
|
||||
[-1, 7, BottleneckCSPA, [768]],
|
||||
[-1, 1, DownC, [1024]], # 10-P6/64
|
||||
[-1, 7, BottleneckCSPA, [1024]], # 11
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 12
|
||||
[-1, 1, Conv, [384, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-6, 1, Conv, [384, 1, 1]], # route backbone P5
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [384]], # 17
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-13, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [256]], # 22
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-20, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [128]], # 27
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, DownC, [256]],
|
||||
[[-1, 22], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [256]], # 31
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, DownC, [384]],
|
||||
[[-1, 17], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [384]], # 35
|
||||
[-1, 1, Conv, [768, 3, 1]],
|
||||
[-2, 1, DownC, [512]],
|
||||
[[-1, 12], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [512]], # 39
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[28,32,36,40], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
||||
]
|
||||
@ -1,63 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # expand model depth
|
||||
width_multiple: 1.25 # expand layer channels
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [ 19,27, 44,40, 38,94 ] # P3/8
|
||||
- [ 96,68, 86,152, 180,137 ] # P4/16
|
||||
- [ 140,301, 303,264, 238,542 ] # P5/32
|
||||
- [ 436,615, 739,380, 925,792 ] # P6/64
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, ReOrg, []], # 0
|
||||
[-1, 1, Conv, [64, 3, 1]], # 1-P1/2
|
||||
[-1, 1, DownC, [128]], # 2-P2/4
|
||||
[-1, 3, BottleneckCSPA, [128]],
|
||||
[-1, 1, DownC, [256]], # 4-P3/8
|
||||
[-1, 7, BottleneckCSPA, [256]],
|
||||
[-1, 1, DownC, [512]], # 6-P4/16
|
||||
[-1, 7, BottleneckCSPA, [512]],
|
||||
[-1, 1, DownC, [768]], # 8-P5/32
|
||||
[-1, 3, BottleneckCSPA, [768]],
|
||||
[-1, 1, DownC, [1024]], # 10-P6/64
|
||||
[-1, 3, BottleneckCSPA, [1024]], # 11
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 12
|
||||
[-1, 1, Conv, [384, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-6, 1, Conv, [384, 1, 1]], # route backbone P5
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [384]], # 17
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-13, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [256]], # 22
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-20, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [128]], # 27
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, DownC, [256]],
|
||||
[[-1, 22], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [256]], # 31
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, DownC, [384]],
|
||||
[[-1, 17], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [384]], # 35
|
||||
[-1, 1, Conv, [768, 3, 1]],
|
||||
[-2, 1, DownC, [512]],
|
||||
[[-1, 12], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [512]], # 39
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[28,32,36,40], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
||||
]
|
||||
@ -1,63 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # expand model depth
|
||||
width_multiple: 1.0 # expand layer channels
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [ 19,27, 44,40, 38,94 ] # P3/8
|
||||
- [ 96,68, 86,152, 180,137 ] # P4/16
|
||||
- [ 140,301, 303,264, 238,542 ] # P5/32
|
||||
- [ 436,615, 739,380, 925,792 ] # P6/64
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, ReOrg, []], # 0
|
||||
[-1, 1, Conv, [64, 3, 1]], # 1-P1/2
|
||||
[-1, 1, Conv, [128, 3, 2]], # 2-P2/4
|
||||
[-1, 3, BottleneckCSPA, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 4-P3/8
|
||||
[-1, 7, BottleneckCSPA, [256]],
|
||||
[-1, 1, Conv, [384, 3, 2]], # 6-P4/16
|
||||
[-1, 7, BottleneckCSPA, [384]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 8-P5/32
|
||||
[-1, 3, BottleneckCSPA, [512]],
|
||||
[-1, 1, Conv, [640, 3, 2]], # 10-P6/64
|
||||
[-1, 3, BottleneckCSPA, [640]], # 11
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [320]], # 12
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-6, 1, Conv, [256, 1, 1]], # route backbone P5
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [256]], # 17
|
||||
[-1, 1, Conv, [192, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-13, 1, Conv, [192, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [192]], # 22
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-20, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [128]], # 27
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [192, 3, 2]],
|
||||
[[-1, 22], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [192]], # 31
|
||||
[-1, 1, Conv, [384, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 17], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [256]], # 35
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [320, 3, 2]],
|
||||
[[-1, 12], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [320]], # 39
|
||||
[-1, 1, Conv, [640, 3, 1]],
|
||||
|
||||
[[28,32,36,40], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
||||
]
|
||||
@ -1,63 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # expand model depth
|
||||
width_multiple: 1.0 # expand layer channels
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [ 19,27, 44,40, 38,94 ] # P3/8
|
||||
- [ 96,68, 86,152, 180,137 ] # P4/16
|
||||
- [ 140,301, 303,264, 238,542 ] # P5/32
|
||||
- [ 436,615, 739,380, 925,792 ] # P6/64
|
||||
|
||||
# CSP-Darknet backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, ReOrg, []], # 0
|
||||
[-1, 1, Conv, [64, 3, 1]], # 1-P1/2
|
||||
[-1, 1, Conv, [128, 3, 2]], # 2-P2/4
|
||||
[-1, 3, BottleneckCSPA, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 4-P3/8
|
||||
[-1, 7, BottleneckCSPA, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 6-P4/16
|
||||
[-1, 7, BottleneckCSPA, [512]],
|
||||
[-1, 1, Conv, [768, 3, 2]], # 8-P5/32
|
||||
[-1, 3, BottleneckCSPA, [768]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 10-P6/64
|
||||
[-1, 3, BottleneckCSPA, [1024]], # 11
|
||||
]
|
||||
|
||||
# CSP-Dark-PAN head
|
||||
head:
|
||||
[[-1, 1, SPPCSPC, [512]], # 12
|
||||
[-1, 1, Conv, [384, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-6, 1, Conv, [384, 1, 1]], # route backbone P5
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [384]], # 17
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-13, 1, Conv, [256, 1, 1]], # route backbone P4
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [256]], # 22
|
||||
[-1, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[-20, 1, Conv, [128, 1, 1]], # route backbone P3
|
||||
[[-1, -2], 1, Concat, [1]],
|
||||
[-1, 3, BottleneckCSPB, [128]], # 27
|
||||
[-1, 1, Conv, [256, 3, 1]],
|
||||
[-2, 1, Conv, [256, 3, 2]],
|
||||
[[-1, 22], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [256]], # 31
|
||||
[-1, 1, Conv, [512, 3, 1]],
|
||||
[-2, 1, Conv, [384, 3, 2]],
|
||||
[[-1, 17], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [384]], # 35
|
||||
[-1, 1, Conv, [768, 3, 1]],
|
||||
[-2, 1, Conv, [512, 3, 2]],
|
||||
[[-1, 12], 1, Concat, [1]], # cat
|
||||
[-1, 3, BottleneckCSPB, [512]], # 39
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
|
||||
[[28,32,36,40], 1, IDetect, [nc, anchors]], # Detect(P3, P4, P5, P6)
|
||||
]
|
||||
@ -1,51 +0,0 @@
|
||||
# parameters
|
||||
nc: 80 # number of classes
|
||||
depth_multiple: 1.0 # model depth multiple
|
||||
width_multiple: 1.0 # layer channel multiple
|
||||
|
||||
# anchors
|
||||
anchors:
|
||||
- [10,13, 16,30, 33,23] # P3/8
|
||||
- [30,61, 62,45, 59,119] # P4/16
|
||||
- [116,90, 156,198, 373,326] # P5/32
|
||||
|
||||
# darknet53 backbone
|
||||
backbone:
|
||||
# [from, number, module, args]
|
||||
[[-1, 1, Conv, [32, 3, 1]], # 0
|
||||
[-1, 1, Conv, [64, 3, 2]], # 1-P1/2
|
||||
[-1, 1, Bottleneck, [64]],
|
||||
[-1, 1, Conv, [128, 3, 2]], # 3-P2/4
|
||||
[-1, 2, Bottleneck, [128]],
|
||||
[-1, 1, Conv, [256, 3, 2]], # 5-P3/8
|
||||
[-1, 8, Bottleneck, [256]],
|
||||
[-1, 1, Conv, [512, 3, 2]], # 7-P4/16
|
||||
[-1, 8, Bottleneck, [512]],
|
||||
[-1, 1, Conv, [1024, 3, 2]], # 9-P5/32
|
||||
[-1, 4, Bottleneck, [1024]], # 10
|
||||
]
|
||||
|
||||
# YOLOv3-SPP head
|
||||
head:
|
||||
[[-1, 1, Bottleneck, [1024, False]],
|
||||
[-1, 1, SPP, [512, [5, 9, 13]]],
|
||||
[-1, 1, Conv, [1024, 3, 1]],
|
||||
[-1, 1, Conv, [512, 1, 1]],
|
||||
[-1, 1, Conv, [1024, 3, 1]], # 15 (P5/32-large)
|
||||
|
||||
[-2, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[[-1, 8], 1, Concat, [1]], # cat backbone P4
|
||||
[-1, 1, Bottleneck, [512, False]],
|
||||
[-1, 1, Bottleneck, [512, False]],
|
||||
[-1, 1, Conv, [256, 1, 1]],
|
||||
[-1, 1, Conv, [512, 3, 1]], # 22 (P4/16-medium)
|
||||
|
||||
[-2, 1, Conv, [128, 1, 1]],
|
||||
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
|
||||
[[-1, 6], 1, Concat, [1]], # cat backbone P3
|
||||
[-1, 1, Bottleneck, [256, False]],
|
||||
[-1, 2, Bottleneck, [256, False]], # 27 (P3/8-small)
|
||||
|
||||
[[27, 22, 15], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
|
||||
]
|
||||