Browse Source

feat: 模型

main
少轻狂 2 years ago
parent
commit
ce23f976bd
No known key found for this signature in database GPG Key ID: 80E176093D33A9AB
11 changed files with 2187 additions and 51 deletions
  1. +634
    -20
      app/api/annotation_data/data.json
  2. +667
    -15
      app/api/annotation_data/dataset.json
  3. +797
    -0
      app/api/annotation_data/val.json
  4. +14
    -1
      app/api/api.py
  5. +10
    -4
      app/api/config.json
  6. +38
    -1
      app/api/model/model.py
  7. BIN
      app/api/model/model_1.1.onnx
  8. +8
    -0
      app/api/命令行.txt
  9. +10
    -1
      app/utils/utils.py
  10. +7
    -3
      src/pages/Personalization/annotations.vue
  11. +2
    -6
      src/pages/Personalization/index.vue

+ 634
- 20
app/api/annotation_data/data.json View File

@@ -7,37 +7,37 @@
}, },
"annotation": [ "annotation": [
{ {
"area": 690,
"area": 882,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
357,
268,
46,
15
355,
263,
42,
21
], ],
"category_id": 3, "category_id": 3,
"ignore": 0 "ignore": 0
}, },
{ {
"area": 946,
"area": 1120,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
453,
260,
43,
22
445,
261,
56,
20
], ],
"category_id": 3, "category_id": 3,
"ignore": 0 "ignore": 0
}, },
{ {
"area": 4900,
"area": 3663,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
391,
353,
98,
50
385,
358,
99,
37
], ],
"category_id": 2, "category_id": 2,
"ignore": 0 "ignore": 0
@@ -74,6 +74,18 @@
], ],
"category_id": 3, "category_id": 3,
"ignore": 0 "ignore": 0
},
{
"area": 2093,
"iscrowd": 0,
"bbox": [
240,
412,
91,
23
],
"category_id": 2,
"ignore": 0
} }
] ]
}, },
@@ -83,7 +95,44 @@
"height": 480, "height": 480,
"width": 640 "width": 640
}, },
"annotation": []
"annotation": [
{
"area": 3366,
"iscrowd": 0,
"bbox": [
240,
430,
99,
34
],
"category_id": 2,
"ignore": 0
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
195,
327,
58,
22
],
"category_id": 3,
"ignore": 0
},
{
"area": 1224,
"iscrowd": 0,
"bbox": [
307,
304,
68,
18
],
"category_id": 3,
"ignore": 0
}
]
}, },
"2022-12-22-15-44-49.jpg": { "2022-12-22-15-44-49.jpg": {
"image": { "image": {
@@ -91,7 +140,44 @@
"height": 480, "height": 480,
"width": 640 "width": 640
}, },
"annotation": []
"annotation": [
{
"area": 833,
"iscrowd": 0,
"bbox": [
203,
324,
49,
17
],
"category_id": 3,
"ignore": 0
},
{
"area": 1701,
"iscrowd": 0,
"bbox": [
305,
299,
63,
27
],
"category_id": 3,
"ignore": 0
},
{
"area": 3400,
"iscrowd": 0,
"bbox": [
239,
427,
100,
34
],
"category_id": 2,
"ignore": 0
}
]
}, },
"2022-12-22-15-44-55.jpg": { "2022-12-22-15-44-55.jpg": {
"image": { "image": {
@@ -99,7 +185,44 @@
"height": 480, "height": 480,
"width": 640 "width": 640
}, },
"annotation": []
"annotation": [
{
"area": 1320,
"iscrowd": 0,
"bbox": [
319,
238,
66,
20
],
"category_id": 1,
"ignore": 0
},
{
"area": 1071,
"iscrowd": 0,
"bbox": [
429,
243,
63,
17
],
"category_id": 1,
"ignore": 0
},
{
"area": 5292,
"iscrowd": 0,
"bbox": [
351,
323,
108,
49
],
"category_id": 4,
"ignore": 0
}
]
}, },
"2022-12-26-10-03-41.jpg": { "2022-12-26-10-03-41.jpg": {
"image": { "image": {
@@ -107,7 +230,44 @@
"height": 480, "height": 480,
"width": 640 "width": 640
}, },
"annotation": []
"annotation": [
{
"area": 1080,
"iscrowd": 0,
"bbox": [
175,
279,
60,
18
],
"category_id": 3,
"ignore": 0
},
{
"area": 1292,
"iscrowd": 0,
"bbox": [
298,
274,
68,
19
],
"category_id": 3,
"ignore": 0
},
{
"area": 4176,
"iscrowd": 0,
"bbox": [
216,
380,
116,
36
],
"category_id": 4,
"ignore": 0
}
]
}, },
"2022-12-26-10-40-15.jpg": { "2022-12-26-10-40-15.jpg": {
"image": { "image": {
@@ -115,6 +275,460 @@
"height": 480, "height": 480,
"width": 640 "width": 640
}, },
"annotation": []
"annotation": [
{
"area": 1920,
"iscrowd": 0,
"bbox": [
277,
391,
64,
30
],
"category_id": 3,
"ignore": 0
},
{
"area": 1680,
"iscrowd": 0,
"bbox": [
405,
406,
60,
28
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-39.jpg": {
"image": {
"file_name": "2022-12-27-10-24-39.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1196,
"iscrowd": 0,
"bbox": [
271,
254,
52,
23
],
"category_id": 3,
"ignore": 0
},
{
"area": 1323,
"iscrowd": 0,
"bbox": [
387,
260,
63,
21
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-41.jpg": {
"image": {
"file_name": "2022-12-27-10-24-41.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1197,
"iscrowd": 0,
"bbox": [
221,
258,
57,
21
],
"category_id": 3,
"ignore": 0
},
{
"area": 1008,
"iscrowd": 0,
"bbox": [
339,
253,
56,
18
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-44.jpg": {
"image": {
"file_name": "2022-12-27-10-24-44.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1625,
"iscrowd": 0,
"bbox": [
237,
194,
65,
25
],
"category_id": 3,
"ignore": 0
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
388,
193,
58,
22
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-46.jpg": {
"image": {
"file_name": "2022-12-27-10-24-46.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1518,
"iscrowd": 0,
"bbox": [
237,
171,
69,
22
],
"category_id": 3,
"ignore": 0
},
{
"area": 1083,
"iscrowd": 0,
"bbox": [
385,
167,
57,
19
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-51.jpg": {
"image": {
"file_name": "2022-12-27-10-24-51.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1584,
"iscrowd": 0,
"bbox": [
175,
183,
72,
22
],
"category_id": 1,
"ignore": 0
},
{
"area": 2240,
"iscrowd": 0,
"bbox": [
317,
171,
80,
28
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-54.jpg": {
"image": {
"file_name": "2022-12-27-10-24-54.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 2025,
"iscrowd": 0,
"bbox": [
239,
167,
75,
27
],
"category_id": 3,
"ignore": 0
},
{
"area": 2106,
"iscrowd": 0,
"bbox": [
379,
181,
81,
26
],
"category_id": 1,
"ignore": 0
}
]
},
"2022-12-27-10-24-56.jpg": {
"image": {
"file_name": "2022-12-27-10-24-56.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1924,
"iscrowd": 0,
"bbox": [
231,
174,
74,
26
],
"category_id": 3,
"ignore": 0
},
{
"area": 1500,
"iscrowd": 0,
"bbox": [
377,
185,
60,
25
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-24-59.jpg": {
"image": {
"file_name": "2022-12-27-10-24-59.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 3080,
"iscrowd": 0,
"bbox": [
217,
174,
88,
35
],
"category_id": 1,
"ignore": 0
},
{
"area": 2184,
"iscrowd": 0,
"bbox": [
377,
189,
78,
28
],
"category_id": 1,
"ignore": 0
}
]
},
"2022-12-27-10-25-09.jpg": {
"image": {
"file_name": "2022-12-27-10-25-09.jpg",
"height": 480,
"width": 640
},
"annotation": [
{
"area": 1680,
"iscrowd": 0,
"bbox": [
81,
242,
84,
20
],
"category_id": 1,
"ignore": 0
},
{
"area": 1620,
"iscrowd": 0,
"bbox": [
242,
221,
81,
20
],
"category_id": 1,
"ignore": 0
}
]
},
"2022-12-27-10-30-28.jpg": {
"image": {
"file_name": "2022-12-27-10-30-28.jpg",
"height": 320,
"width": 320
},
"annotation": [
{
"area": 1700,
"iscrowd": 0,
"bbox": [
75,
144,
68,
25
],
"category_id": 3,
"ignore": 0
},
{
"area": 1536,
"iscrowd": 0,
"bbox": [
197,
148,
64,
24
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-30-33.jpg": {
"image": {
"file_name": "2022-12-27-10-30-33.jpg",
"height": 320,
"width": 320
},
"annotation": [
{
"area": 2490,
"iscrowd": 0,
"bbox": [
20,
155,
83,
30
],
"category_id": 3,
"ignore": 0
},
{
"area": 1702,
"iscrowd": 0,
"bbox": [
163,
152,
74,
23
],
"category_id": 3,
"ignore": 0
}
]
},
"2022-12-27-10-30-37.jpg": {
"image": {
"file_name": "2022-12-27-10-30-37.jpg",
"height": 320,
"width": 320
},
"annotation": [
{
"area": 1235,
"iscrowd": 0,
"bbox": [
173,
117,
65,
19
],
"category_id": 3,
"ignore": 0
},
{
"area": 1386,
"iscrowd": 0,
"bbox": [
42,
126,
77,
18
],
"category_id": 1,
"ignore": 0
}
]
},
"2022-12-27-10-30-41.jpg": {
"image": {
"file_name": "2022-12-27-10-30-41.jpg",
"height": 320,
"width": 320
},
"annotation": [
{
"area": 1420,
"iscrowd": 0,
"bbox": [
177,
139,
71,
20
],
"category_id": 1,
"ignore": 0
},
{
"area": 1564,
"iscrowd": 0,
"bbox": [
57,
141,
68,
23
],
"category_id": 3,
"ignore": 0
}
]
} }
} }

+ 667
- 15
app/api/annotation_data/dataset.json View File

@@ -41,18 +41,96 @@
"height": 480, "height": 480,
"width": 640, "width": 640,
"id": 6 "id": 6
},
{
"file_name": "2022-12-27-10-24-39.jpg",
"height": 480,
"width": 640,
"id": 7
},
{
"file_name": "2022-12-27-10-24-41.jpg",
"height": 480,
"width": 640,
"id": 8
},
{
"file_name": "2022-12-27-10-24-44.jpg",
"height": 480,
"width": 640,
"id": 9
},
{
"file_name": "2022-12-27-10-24-46.jpg",
"height": 480,
"width": 640,
"id": 10
},
{
"file_name": "2022-12-27-10-24-51.jpg",
"height": 480,
"width": 640,
"id": 11
},
{
"file_name": "2022-12-27-10-24-54.jpg",
"height": 480,
"width": 640,
"id": 12
},
{
"file_name": "2022-12-27-10-24-56.jpg",
"height": 480,
"width": 640,
"id": 13
},
{
"file_name": "2022-12-27-10-24-59.jpg",
"height": 480,
"width": 640,
"id": 14
},
{
"file_name": "2022-12-27-10-25-09.jpg",
"height": 480,
"width": 640,
"id": 15
},
{
"file_name": "2022-12-27-10-30-28.jpg",
"height": 320,
"width": 320,
"id": 16
},
{
"file_name": "2022-12-27-10-30-33.jpg",
"height": 320,
"width": 320,
"id": 17
},
{
"file_name": "2022-12-27-10-30-37.jpg",
"height": 320,
"width": 320,
"id": 18
},
{
"file_name": "2022-12-27-10-30-41.jpg",
"height": 320,
"width": 320,
"id": 19
} }
], ],
"type": "instances", "type": "instances",
"annotations": [ "annotations": [
{ {
"area": 690,
"area": 882,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
357,
268,
46,
15
355,
263,
42,
21
], ],
"category_id": 3, "category_id": 3,
"ignore": 0, "ignore": 0,
@@ -60,13 +138,13 @@
"id": 0 "id": 0
}, },
{ {
"area": 946,
"area": 1120,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
453,
260,
43,
22
445,
261,
56,
20
], ],
"category_id": 3, "category_id": 3,
"ignore": 0, "ignore": 0,
@@ -74,13 +152,13 @@
"id": 1 "id": 1
}, },
{ {
"area": 4900,
"area": 3663,
"iscrowd": 0, "iscrowd": 0,
"bbox": [ "bbox": [
391,
353,
98,
50
385,
358,
99,
37
], ],
"category_id": 2, "category_id": 2,
"ignore": 0, "ignore": 0,
@@ -114,6 +192,580 @@
"ignore": 0, "ignore": 0,
"image_id": 1, "image_id": 1,
"id": 4 "id": 4
},
{
"area": 2093,
"iscrowd": 0,
"bbox": [
240,
412,
91,
23
],
"category_id": 2,
"ignore": 0,
"image_id": 1,
"id": 5
},
{
"area": 3366,
"iscrowd": 0,
"bbox": [
240,
430,
99,
34
],
"category_id": 2,
"ignore": 0,
"image_id": 2,
"id": 6
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
195,
327,
58,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 2,
"id": 7
},
{
"area": 1224,
"iscrowd": 0,
"bbox": [
307,
304,
68,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 2,
"id": 8
},
{
"area": 833,
"iscrowd": 0,
"bbox": [
203,
324,
49,
17
],
"category_id": 3,
"ignore": 0,
"image_id": 3,
"id": 9
},
{
"area": 1701,
"iscrowd": 0,
"bbox": [
305,
299,
63,
27
],
"category_id": 3,
"ignore": 0,
"image_id": 3,
"id": 10
},
{
"area": 3400,
"iscrowd": 0,
"bbox": [
239,
427,
100,
34
],
"category_id": 2,
"ignore": 0,
"image_id": 3,
"id": 11
},
{
"area": 1320,
"iscrowd": 0,
"bbox": [
319,
238,
66,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 4,
"id": 12
},
{
"area": 1071,
"iscrowd": 0,
"bbox": [
429,
243,
63,
17
],
"category_id": 1,
"ignore": 0,
"image_id": 4,
"id": 13
},
{
"area": 5292,
"iscrowd": 0,
"bbox": [
351,
323,
108,
49
],
"category_id": 4,
"ignore": 0,
"image_id": 4,
"id": 14
},
{
"area": 1080,
"iscrowd": 0,
"bbox": [
175,
279,
60,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 5,
"id": 15
},
{
"area": 1292,
"iscrowd": 0,
"bbox": [
298,
274,
68,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 5,
"id": 16
},
{
"area": 4176,
"iscrowd": 0,
"bbox": [
216,
380,
116,
36
],
"category_id": 4,
"ignore": 0,
"image_id": 5,
"id": 17
},
{
"area": 1920,
"iscrowd": 0,
"bbox": [
277,
391,
64,
30
],
"category_id": 3,
"ignore": 0,
"image_id": 6,
"id": 18
},
{
"area": 1680,
"iscrowd": 0,
"bbox": [
405,
406,
60,
28
],
"category_id": 3,
"ignore": 0,
"image_id": 6,
"id": 19
},
{
"area": 1196,
"iscrowd": 0,
"bbox": [
271,
254,
52,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 7,
"id": 20
},
{
"area": 1323,
"iscrowd": 0,
"bbox": [
387,
260,
63,
21
],
"category_id": 3,
"ignore": 0,
"image_id": 7,
"id": 21
},
{
"area": 1197,
"iscrowd": 0,
"bbox": [
221,
258,
57,
21
],
"category_id": 3,
"ignore": 0,
"image_id": 8,
"id": 22
},
{
"area": 1008,
"iscrowd": 0,
"bbox": [
339,
253,
56,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 8,
"id": 23
},
{
"area": 1625,
"iscrowd": 0,
"bbox": [
237,
194,
65,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 9,
"id": 24
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
388,
193,
58,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 9,
"id": 25
},
{
"area": 1518,
"iscrowd": 0,
"bbox": [
237,
171,
69,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 10,
"id": 26
},
{
"area": 1083,
"iscrowd": 0,
"bbox": [
385,
167,
57,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 10,
"id": 27
},
{
"area": 1584,
"iscrowd": 0,
"bbox": [
175,
183,
72,
22
],
"category_id": 1,
"ignore": 0,
"image_id": 11,
"id": 28
},
{
"area": 2240,
"iscrowd": 0,
"bbox": [
317,
171,
80,
28
],
"category_id": 3,
"ignore": 0,
"image_id": 11,
"id": 29
},
{
"area": 2025,
"iscrowd": 0,
"bbox": [
239,
167,
75,
27
],
"category_id": 3,
"ignore": 0,
"image_id": 12,
"id": 30
},
{
"area": 2106,
"iscrowd": 0,
"bbox": [
379,
181,
81,
26
],
"category_id": 1,
"ignore": 0,
"image_id": 12,
"id": 31
},
{
"area": 1924,
"iscrowd": 0,
"bbox": [
231,
174,
74,
26
],
"category_id": 3,
"ignore": 0,
"image_id": 13,
"id": 32
},
{
"area": 1500,
"iscrowd": 0,
"bbox": [
377,
185,
60,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 13,
"id": 33
},
{
"area": 3080,
"iscrowd": 0,
"bbox": [
217,
174,
88,
35
],
"category_id": 1,
"ignore": 0,
"image_id": 14,
"id": 34
},
{
"area": 2184,
"iscrowd": 0,
"bbox": [
377,
189,
78,
28
],
"category_id": 1,
"ignore": 0,
"image_id": 14,
"id": 35
},
{
"area": 1680,
"iscrowd": 0,
"bbox": [
81,
242,
84,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 15,
"id": 36
},
{
"area": 1620,
"iscrowd": 0,
"bbox": [
242,
221,
81,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 15,
"id": 37
},
{
"area": 1700,
"iscrowd": 0,
"bbox": [
75,
144,
68,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 16,
"id": 38
},
{
"area": 1536,
"iscrowd": 0,
"bbox": [
197,
148,
64,
24
],
"category_id": 3,
"ignore": 0,
"image_id": 16,
"id": 39
},
{
"area": 2490,
"iscrowd": 0,
"bbox": [
20,
155,
83,
30
],
"category_id": 3,
"ignore": 0,
"image_id": 17,
"id": 40
},
{
"area": 1702,
"iscrowd": 0,
"bbox": [
163,
152,
74,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 17,
"id": 41
},
{
"area": 1235,
"iscrowd": 0,
"bbox": [
173,
117,
65,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 18,
"id": 42
},
{
"area": 1386,
"iscrowd": 0,
"bbox": [
42,
126,
77,
18
],
"category_id": 1,
"ignore": 0,
"image_id": 18,
"id": 43
},
{
"area": 1420,
"iscrowd": 0,
"bbox": [
177,
139,
71,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 19,
"id": 44
},
{
"area": 1564,
"iscrowd": 0,
"bbox": [
57,
141,
68,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 19,
"id": 45
} }
], ],
"categories": [ "categories": [


+ 797
- 0
app/api/annotation_data/val.json View File

@@ -0,0 +1,797 @@
{
"images": [
{
"file_name": "2022-12-22-15-30-01.jpg",
"height": 480,
"width": 640,
"id": 0
},
{
"file_name": "2022-12-22-15-38-16.jpg",
"height": 480,
"width": 640,
"id": 1
},
{
"file_name": "2022-12-22-15-44-48.jpg",
"height": 480,
"width": 640,
"id": 2
},
{
"file_name": "2022-12-22-15-44-49.jpg",
"height": 480,
"width": 640,
"id": 3
},
{
"file_name": "2022-12-22-15-44-55.jpg",
"height": 480,
"width": 640,
"id": 4
},
{
"file_name": "2022-12-26-10-03-41.jpg",
"height": 480,
"width": 640,
"id": 5
},
{
"file_name": "2022-12-26-10-40-15.jpg",
"height": 480,
"width": 640,
"id": 6
},
{
"file_name": "2022-12-27-10-24-39.jpg",
"height": 480,
"width": 640,
"id": 7
},
{
"file_name": "2022-12-27-10-24-41.jpg",
"height": 480,
"width": 640,
"id": 8
},
{
"file_name": "2022-12-27-10-24-44.jpg",
"height": 480,
"width": 640,
"id": 9
},
{
"file_name": "2022-12-27-10-24-46.jpg",
"height": 480,
"width": 640,
"id": 10
},
{
"file_name": "2022-12-27-10-24-51.jpg",
"height": 480,
"width": 640,
"id": 11
},
{
"file_name": "2022-12-27-10-24-54.jpg",
"height": 480,
"width": 640,
"id": 12
},
{
"file_name": "2022-12-27-10-24-56.jpg",
"height": 480,
"width": 640,
"id": 13
},
{
"file_name": "2022-12-27-10-24-59.jpg",
"height": 480,
"width": 640,
"id": 14
},
{
"file_name": "2022-12-27-10-25-09.jpg",
"height": 480,
"width": 640,
"id": 15
},
{
"file_name": "2022-12-27-10-30-28.jpg",
"height": 320,
"width": 320,
"id": 16
},
{
"file_name": "2022-12-27-10-30-33.jpg",
"height": 320,
"width": 320,
"id": 17
},
{
"file_name": "2022-12-27-10-30-37.jpg",
"height": 320,
"width": 320,
"id": 18
},
{
"file_name": "2022-12-27-10-30-41.jpg",
"height": 320,
"width": 320,
"id": 19
}
],
"type": "instances",
"annotations": [
{
"area": 882,
"iscrowd": 0,
"bbox": [
355,
263,
42,
21
],
"category_id": 3,
"ignore": 0,
"image_id": 0,
"id": 0
},
{
"area": 1120,
"iscrowd": 0,
"bbox": [
445,
261,
56,
20
],
"category_id": 3,
"ignore": 0,
"image_id": 0,
"id": 1
},
{
"area": 3663,
"iscrowd": 0,
"bbox": [
385,
358,
99,
37
],
"category_id": 2,
"ignore": 0,
"image_id": 0,
"id": 2
},
{
"area": 680,
"iscrowd": 0,
"bbox": [
211,
356,
40,
17
],
"category_id": 3,
"ignore": 0,
"image_id": 1,
"id": 3
},
{
"area": 728,
"iscrowd": 0,
"bbox": [
289,
347,
52,
14
],
"category_id": 3,
"ignore": 0,
"image_id": 1,
"id": 4
},
{
"area": 2093,
"iscrowd": 0,
"bbox": [
240,
412,
91,
23
],
"category_id": 2,
"ignore": 0,
"image_id": 1,
"id": 5
},
{
"area": 3366,
"iscrowd": 0,
"bbox": [
240,
430,
99,
34
],
"category_id": 2,
"ignore": 0,
"image_id": 2,
"id": 6
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
195,
327,
58,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 2,
"id": 7
},
{
"area": 1224,
"iscrowd": 0,
"bbox": [
307,
304,
68,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 2,
"id": 8
},
{
"area": 833,
"iscrowd": 0,
"bbox": [
203,
324,
49,
17
],
"category_id": 3,
"ignore": 0,
"image_id": 3,
"id": 9
},
{
"area": 1701,
"iscrowd": 0,
"bbox": [
305,
299,
63,
27
],
"category_id": 3,
"ignore": 0,
"image_id": 3,
"id": 10
},
{
"area": 3400,
"iscrowd": 0,
"bbox": [
239,
427,
100,
34
],
"category_id": 2,
"ignore": 0,
"image_id": 3,
"id": 11
},
{
"area": 1320,
"iscrowd": 0,
"bbox": [
319,
238,
66,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 4,
"id": 12
},
{
"area": 1071,
"iscrowd": 0,
"bbox": [
429,
243,
63,
17
],
"category_id": 1,
"ignore": 0,
"image_id": 4,
"id": 13
},
{
"area": 5292,
"iscrowd": 0,
"bbox": [
351,
323,
108,
49
],
"category_id": 4,
"ignore": 0,
"image_id": 4,
"id": 14
},
{
"area": 1080,
"iscrowd": 0,
"bbox": [
175,
279,
60,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 5,
"id": 15
},
{
"area": 1292,
"iscrowd": 0,
"bbox": [
298,
274,
68,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 5,
"id": 16
},
{
"area": 4176,
"iscrowd": 0,
"bbox": [
216,
380,
116,
36
],
"category_id": 4,
"ignore": 0,
"image_id": 5,
"id": 17
},
{
"area": 1920,
"iscrowd": 0,
"bbox": [
277,
391,
64,
30
],
"category_id": 3,
"ignore": 0,
"image_id": 6,
"id": 18
},
{
"area": 1680,
"iscrowd": 0,
"bbox": [
405,
406,
60,
28
],
"category_id": 3,
"ignore": 0,
"image_id": 6,
"id": 19
},
{
"area": 1196,
"iscrowd": 0,
"bbox": [
271,
254,
52,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 7,
"id": 20
},
{
"area": 1323,
"iscrowd": 0,
"bbox": [
387,
260,
63,
21
],
"category_id": 3,
"ignore": 0,
"image_id": 7,
"id": 21
},
{
"area": 1197,
"iscrowd": 0,
"bbox": [
221,
258,
57,
21
],
"category_id": 3,
"ignore": 0,
"image_id": 8,
"id": 22
},
{
"area": 1008,
"iscrowd": 0,
"bbox": [
339,
253,
56,
18
],
"category_id": 3,
"ignore": 0,
"image_id": 8,
"id": 23
},
{
"area": 1625,
"iscrowd": 0,
"bbox": [
237,
194,
65,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 9,
"id": 24
},
{
"area": 1276,
"iscrowd": 0,
"bbox": [
388,
193,
58,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 9,
"id": 25
},
{
"area": 1518,
"iscrowd": 0,
"bbox": [
237,
171,
69,
22
],
"category_id": 3,
"ignore": 0,
"image_id": 10,
"id": 26
},
{
"area": 1083,
"iscrowd": 0,
"bbox": [
385,
167,
57,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 10,
"id": 27
},
{
"area": 1584,
"iscrowd": 0,
"bbox": [
175,
183,
72,
22
],
"category_id": 1,
"ignore": 0,
"image_id": 11,
"id": 28
},
{
"area": 2240,
"iscrowd": 0,
"bbox": [
317,
171,
80,
28
],
"category_id": 3,
"ignore": 0,
"image_id": 11,
"id": 29
},
{
"area": 2025,
"iscrowd": 0,
"bbox": [
239,
167,
75,
27
],
"category_id": 3,
"ignore": 0,
"image_id": 12,
"id": 30
},
{
"area": 2106,
"iscrowd": 0,
"bbox": [
379,
181,
81,
26
],
"category_id": 1,
"ignore": 0,
"image_id": 12,
"id": 31
},
{
"area": 1924,
"iscrowd": 0,
"bbox": [
231,
174,
74,
26
],
"category_id": 3,
"ignore": 0,
"image_id": 13,
"id": 32
},
{
"area": 1500,
"iscrowd": 0,
"bbox": [
377,
185,
60,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 13,
"id": 33
},
{
"area": 3080,
"iscrowd": 0,
"bbox": [
217,
174,
88,
35
],
"category_id": 1,
"ignore": 0,
"image_id": 14,
"id": 34
},
{
"area": 2184,
"iscrowd": 0,
"bbox": [
377,
189,
78,
28
],
"category_id": 1,
"ignore": 0,
"image_id": 14,
"id": 35
},
{
"area": 1680,
"iscrowd": 0,
"bbox": [
81,
242,
84,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 15,
"id": 36
},
{
"area": 1620,
"iscrowd": 0,
"bbox": [
242,
221,
81,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 15,
"id": 37
},
{
"area": 1700,
"iscrowd": 0,
"bbox": [
75,
144,
68,
25
],
"category_id": 3,
"ignore": 0,
"image_id": 16,
"id": 38
},
{
"area": 1536,
"iscrowd": 0,
"bbox": [
197,
148,
64,
24
],
"category_id": 3,
"ignore": 0,
"image_id": 16,
"id": 39
},
{
"area": 2490,
"iscrowd": 0,
"bbox": [
20,
155,
83,
30
],
"category_id": 3,
"ignore": 0,
"image_id": 17,
"id": 40
},
{
"area": 1702,
"iscrowd": 0,
"bbox": [
163,
152,
74,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 17,
"id": 41
},
{
"area": 1235,
"iscrowd": 0,
"bbox": [
173,
117,
65,
19
],
"category_id": 3,
"ignore": 0,
"image_id": 18,
"id": 42
},
{
"area": 1386,
"iscrowd": 0,
"bbox": [
42,
126,
77,
18
],
"category_id": 1,
"ignore": 0,
"image_id": 18,
"id": 43
},
{
"area": 1420,
"iscrowd": 0,
"bbox": [
177,
139,
71,
20
],
"category_id": 1,
"ignore": 0,
"image_id": 19,
"id": 44
},
{
"area": 1564,
"iscrowd": 0,
"bbox": [
57,
141,
68,
23
],
"category_id": 3,
"ignore": 0,
"image_id": 19,
"id": 45
}
],
"categories": [
{
"supercategory": "none",
"id": 1,
"name": "closed_eye",
"color": "#E3170D85"
},
{
"supercategory": "none",
"id": 2,
"name": "closed_mouth",
"color": "#1E90FF85"
},
{
"supercategory": "none",
"id": 3,
"name": "open_eye",
"color": "#32CD3285"
},
{
"supercategory": "none",
"id": 4,
"name": "open_mouth",
"color": "#C0C0C085"
}
]
}

+ 14
- 1
app/api/api.py View File

@@ -69,6 +69,19 @@ def mat2base64(frame):
image = cv2.imencode('.jpg',frame)[1] image = cv2.imencode('.jpg',frame)[1]
image_code = str(base64.b64encode(image))[2:-1] image_code = str(base64.b64encode(image))[2:-1]
return image_code return image_code
def getModelSetting(args):
import requests
url = 'https://gitee.com/JiangNoah/emc/raw/master/model.json'
r = requests.get(url)
model_dict = (r.json())["models"]
#将get_settings_status_name(args,"ModelSetting","模型版本设置")在model_dict的list中对应的status设置为true
for model in model_dict:
if model["name"] == get_settings_status_name(args,"ModelSetting","模型版本设置"):
model["status"] = True
else:
model["status"] = False
args["ModelSetting"][0]["status"] = model_dict
return args


class API: class API:
'''本地API,供前端JS调用''' '''本地API,供前端JS调用'''
@@ -81,7 +94,7 @@ class API:
def __init__(self): def __init__(self):
with open(getFile("config.json"),'r',encoding='utf8')as fp: with open(getFile("config.json"),'r',encoding='utf8')as fp:
self.args = json.load(fp) self.args = json.load(fp)
self.args = getModelSetting(self.args)
self.net = PicoDet( self.net = PicoDet(
get_settings_status_name(self.args,"ModelSetting","模型版本设置"), get_settings_status_name(self.args,"ModelSetting","模型版本设置"),
self.args['classfile'], self.args['classfile'],


+ 10
- 4
app/api/config.json View File

@@ -2,16 +2,16 @@
"classfile": "coco_label.txt", "classfile": "coco_label.txt",
"img_fold": "./imgs", "img_fold": "./imgs",
"result_fold": "results", "result_fold": "results",
"toggle": false,
"tip": false,
"toggle": true,
"tip": true,
"control": [ "control": [
{ {
"name": "嘴控", "name": "嘴控",
"status": true
"status": false
}, },
{ {
"name": "眼控", "name": "眼控",
"status": false
"status": true
}, },
{ {
"name": "嘴/眼控", "name": "嘴/眼控",
@@ -61,7 +61,13 @@
"status": [ "status": [
{ {
"name": "model_1.0.onnx", "name": "model_1.0.onnx",
"url": "http://docs.marlene.top/demo/model/model_1.0.onnx",
"status": true "status": true
},
{
"name": "model_1.1.onnx",
"url": "http://docs.marlene.top/demo/model/model_1.1.onnx",
"status": false
} }
], ],
"description": "目前仅有官方提供模型,可通过个性化设置进行修改", "description": "目前仅有官方提供模型,可通过个性化设置进行修改",


+ 38
- 1
app/api/model/model.py View File

@@ -8,6 +8,8 @@ from tqdm import tqdm
import time import time
import sys import sys
import os import os
import requests
from utils.utils import send_notifycation


def getFile(ruleFile): def getFile(ruleFile):
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
@@ -18,6 +20,41 @@ def getFile(ruleFile):
absPath = '' absPath = ''
return os.path.join(absPath,ruleFile) return os.path.join(absPath,ruleFile)


def checkModel(model):
"""
【功能】检查模型是否存在
【参数】
model: str 必选,模型名称
【输入/输出】
True: 模型存在
False: 模型不存在
"""
# 先检查本地是否存在该文件模型,不存在则查看网络数据库是否存在该模型,存在则下载然后返回该模型
if not os.path.exists(getFile(model)):
send_notifycation('模型不存在,正在下载模型...')
url = 'https://gitee.com/JiangNoah/emc/raw/master/model.json'
r = requests.get(url)
model_dict = r.json()# model_dict = {models:[{'name':model,'url':url}]}
#检查是否存在该模型的name
models = model_dict["models"]
url_ = ''
for m in models:
if m["name"] == model:
url_ = m["url"]
break
if url_ == '':
send_notifycation('模型不存在')
return getFile(model)
else:
send_notifycation('模型下载中...')
r = requests.get(url_)
with open(getFile(model), 'wb') as f:
f.write(r.content)
send_notifycation('模型下载完成')
return getFile(model)
else:
return getFile(model)



class PicoDet(): class PicoDet():
def __init__(self, def __init__(self,
@@ -36,7 +73,7 @@ class PicoDet():
[57.375, 57.12, 58.395], dtype=np.float32).reshape(1, 1, 3) [57.375, 57.12, 58.395], dtype=np.float32).reshape(1, 1, 3)
so = ort.SessionOptions() so = ort.SessionOptions()
so.log_severity_level = 3 so.log_severity_level = 3
self.net = ort.InferenceSession(getFile(model_pb_path), so)
self.net = ort.InferenceSession(checkModel(model_pb_path), so)
inputs_name = [a.name for a in self.net.get_inputs()] inputs_name = [a.name for a in self.net.get_inputs()]
inputs_shape = { inputs_shape = {
k: v.shape k: v.shape


BIN
app/api/model/model_1.1.onnx View File


+ 8
- 0
app/api/命令行.txt View File

@@ -0,0 +1,8 @@
python tools/train.py -c configs/picodet_xs_320_coco_lcnet.yml -o use_gpu=false --eval


python tools/export_model.py -c configs/picodet_xs_320_coco_lcnet.yml -o weights=output/picodet_xs_320_coco_lcnet/model_final.pdparams num_classes=4 --output_dir=inference_model

paddle2onnx --model_dir inference_model/picodet_xs_320_coco_lcnet --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 11 --save_file picodet_xs_320_coco.onnx

python -m paddle2onnx.optimize --input_model picodet_xs_320_coco.onnx --output_model picodet_xs_processed.onnx

+ 10
- 1
app/utils/utils.py View File

@@ -1,4 +1,13 @@
import subprocess import subprocess
import os,sys
def getFile(ruleFile):
if getattr(sys, 'frozen', False):
absPath = os.path.dirname(os.path.abspath(sys.executable))
elif __file__:
absPath = os.path.dirname(os.path.abspath(__file__))
else:
absPath = ''
return os.path.join(absPath,ruleFile)
def send_notifycation (content: str = '', title: str = 'New notifycation', def send_notifycation (content: str = '', title: str = 'New notifycation',
tip_type: str = 'None', duration: int = 3) -> None: tip_type: str = 'None', duration: int = 3) -> None:
""" """
@@ -28,4 +37,4 @@ def send_notifycation (content: str = '', title: str = 'New notifycation',
'-win', 'Hidden', '-c', '& {%s}' % ( '-win', 'Hidden', '-c', '& {%s}' % (
"".join([d.get(c, c) for c in (s)]) % ( "".join([d.get(c, c) for c in (s)]) % (
content, title, tip_type, duration)) content, title, tip_type, duration))
])
])

+ 7
- 3
src/pages/Personalization/annotations.vue View File

@@ -211,6 +211,10 @@ const DrawLayerMousemove = (e) => {
} }
} }


const unFinished = () => {
alert('目前仅支持云端训练,且只支持手动上传数据集,后续会支持更多功能')
}

const expertAllData = async () => { const expertAllData = async () => {
const imgData = [] const imgData = []
let annotationData = [] let annotationData = []
@@ -235,11 +239,11 @@ const expertAllData = async () => {
} }
expertData.mergeData.images = imgData expertData.mergeData.images = imgData
expertData.mergeData.annotations = annotationData expertData.mergeData.annotations = annotationData
console.log(JSON.parse(JSON.stringify(expertData.mergeData)))
await window.pywebview.api.saveAnnotationData(expertData.annotationData, expertData.mergeData) await window.pywebview.api.saveAnnotationData(expertData.annotationData, expertData.mergeData)


const toast = new ToastCreator({ message: '数据集标注结果已保存', type: 'success', duration: 1500 }) const toast = new ToastCreator({ message: '数据集标注结果已保存', type: 'success', duration: 1500 })
toast.createToast() toast.createToast()
unFinished()
} }


watch( watch(
@@ -408,12 +412,12 @@ onMounted(async () => {
<div class="flex-col items-end"> <div class="flex-col items-end">
<div class="btn-group"> <div class="btn-group">
<button class="btn hover:btn-primary" @click="expertAllData()"> <button class="btn hover:btn-primary" @click="expertAllData()">
<router-link to="/Personalization/train" class="flex items-center">
<router-link class="flex items-center">
<div i-mingcute-cloud-line />云端训练 <div i-mingcute-cloud-line />云端训练
</router-link> </router-link>
</button> </button>
<button class="btn hover:btn-primary" @click="expertAllData()"> <button class="btn hover:btn-primary" @click="expertAllData()">
<router-link to="/Personalization/train" class="flex items-center">
<router-link class="flex items-center">
<div i-mingcute-computer-line />本地训练 <div i-mingcute-computer-line />本地训练
</router-link> </router-link>
</button> </button>


+ 2
- 6
src/pages/Personalization/index.vue View File

@@ -13,24 +13,20 @@ const { t } = useI18n()
const imgType = reactive({ const imgType = reactive({
name: '图片载入方式', name: '图片载入方式',
status: [ status: [
{
name: '不裁剪',
status: true,
},
{ {
name: '居中裁剪成224*224', name: '居中裁剪成224*224',
status: false, status: false,
}, },
{ {
name: '居中裁剪成320*320', name: '居中裁剪成320*320',
status: false,
status: true,
}, },
], ],
}) })
// 找到imgType的status为true的name // 找到imgType的status为true的name
const imgTypeStatus = computed(() => { const imgTypeStatus = computed(() => {
const opt = imgType.status.find(option => option.status === true) const opt = imgType.status.find(option => option.status === true)
return opt ? opt.name : '不裁剪'
return opt ? opt.name : '居中裁剪成320*320'
}) })
let currentImgUrl = $ref('') let currentImgUrl = $ref('')
let ImgLength = $ref(0) let ImgLength = $ref(0)


Loading…
Cancel
Save