Creating Classifier
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"input_path = '../images/Mision 23_DJI_0061.jpg' \n",
|
||||
"#output_path = 'Result_Complete_Example/'\n",
|
||||
"#makedirs(output_path)"
|
||||
"output_path = 'Result_Complete_Example/'\n",
|
||||
"makedirs(output_path)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -195,16 +195,59 @@
|
||||
" draw_boxes(image, boxes_cellD, config_cellD['model']['labels'], obj_thresh, number_color = 4)\n",
|
||||
" draw_boxes(image, boxes_disc, ['disc'], obj_thresh, number_color = 5)\n",
|
||||
" \n",
|
||||
" cv2.imwrite(output_path + image_path.split('/')[-1], np.uint8(image))\n",
|
||||
" # write the image with bounding boxes to file\n",
|
||||
" plt.figure(figsize=(16, 16))\n",
|
||||
" plt.imshow(image)\n",
|
||||
" #plt.figure(figsize=(16, 16))\n",
|
||||
" #plt.imshow(image)\n",
|
||||
"\n",
|
||||
"#file = open(output_path + 'time.txt','w')\n",
|
||||
"#file.write('Tiempo promedio:' + str(np.mean(times)))\n",
|
||||
"#file.close()\n",
|
||||
"file = open(output_path + 'time.txt','w')\n",
|
||||
"file.write('Tiempo promedio:' + str(np.mean(times)))\n",
|
||||
"file.close()\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Example One image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"image_path = image_paths[55]\n",
|
||||
"\n",
|
||||
"image = cv2.imread(image_path)\n",
|
||||
"plt.figure(figsize=(12, 10))\n",
|
||||
"plt.imshow(image)\n",
|
||||
"print(image_path)\n",
|
||||
"\n",
|
||||
"start = time.time()\n",
|
||||
"# predict the bounding boxes\n",
|
||||
"boxes_soiling = get_yolo_boxes(infer_model_soiling, [image], net_h, net_w, config_soiling['model']['anchors'], obj_thresh, nms_thresh)[0]\n",
|
||||
"boxes_diode = get_yolo_boxes(infer_model_diode, [image], net_h, net_w, config_diode['model']['anchors'], obj_thresh, nms_thresh)[0]\n",
|
||||
"boxes_cellD = get_yolo_boxes(infer_model_cellD, [image], net_h, net_w, config_cellD['model']['anchors'], obj_thresh, nms_thresh)[0]\n",
|
||||
"boxes_panel = get_yolo_boxes(infer_model_panel, [image], net_h, net_w, config_panel['model']['anchors'], obj_thresh, nms_thresh_panel)[0]\n",
|
||||
"boxes_panel = [box for box in boxes_panel if box.get_score() > obj_thresh]\n",
|
||||
"boxes_disc = disconnect(image, boxes_panel, z_thresh = 1.8)\n",
|
||||
"print('Elapsed time = {}'.format(time.time() - start))\n",
|
||||
"times.append(time.time() - start)\n",
|
||||
"# Draw boxes\n",
|
||||
"draw_boxes(image, boxes_soiling, config_soiling['model']['labels'], obj_thresh, number_color = 0)\n",
|
||||
"draw_boxes(image, boxes_diode, config_diode['model']['labels'], obj_thresh, number_color = 2)\n",
|
||||
"draw_boxes(image, boxes_cellD, config_cellD['model']['labels'], obj_thresh, number_color = 4)\n",
|
||||
"draw_boxes(image, boxes_disc, ['disc'], obj_thresh, number_color = 5)\n",
|
||||
"\n",
|
||||
"print('Elapsed time = {}'.format(time.time() - start))\n",
|
||||
"times.append(time.time() - start)\n",
|
||||
"plt.figure(figsize=(12, 10))\n",
|
||||
"plt.imshow(image)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
||||
Reference in New Issue
Block a user