381 lines
27 KiB
Plaintext
381 lines
27 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"id": "2d4f51fc-c3e6-436f-90bb-849e54a62ee5",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import cv2\n",
|
|
"import json\n",
|
|
"import copy\n",
|
|
"import numpy as np\n",
|
|
"from PIL import Image\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"from skimage.measure import label\n",
|
|
"from skimage.measure import regionprops"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "246b2cde-704f-4930-b0c7-a1bb07d0b490",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"json_path = '../msunet/logs/0/version_0/test.json'\n",
|
|
"\n",
|
|
"with open(json_path) as f:\n",
|
|
" data = json.load(f)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"id": "e3b627c6-67cc-4ea5-990f-74558b609c2c",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"(8, 2048, 2048)"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"pred = np.array(data['pred']); pred.shape"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "59ee302c-4b42-45c0-b99b-cd4f37d5ce4b",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['../../data/patch_unet//test/img/10.png',\n",
|
|
" '../../data/patch_unet//test/img/4.png',\n",
|
|
" '../../data/patch_unet//test/img/40.png',\n",
|
|
" '../../data/patch_unet//test/img/20.png',\n",
|
|
" '../../data/patch_unet//test/img/6.png',\n",
|
|
" '../../data/patch_unet//test/img/8.png',\n",
|
|
" '../../data/patch_unet//test/img/2.png',\n",
|
|
" '../../data/patch_unet//test/img/30.png']"
|
|
]
|
|
},
|
|
"execution_count": 9,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"data['img_path']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"id": "1a52ef4e-443e-4a40-be32-201617b20fd8",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<Figure size 600x600 with 0 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"plt.figure(figsize=(6, 6))\n",
|
|
"patch = copy.deepcopy(pred[3][759:817, 540:600])\n",
|
|
"patch[:19, 56:] = 0\n",
|
|
"patch = cv2.dilate(patch, np.ones((3, 3)))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "589524d8-6c4d-47dd-968a-fab14adbd9c7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"img = np.zeros((64, 64))\n",
|
|
"img[3:61, 2:62] = patch\n",
|
|
"patch = img"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "bf7c7fa2-789b-4c19-8ad0-3d2e15d8407d",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"(-0.5, 63.5, 63.5, -0.5)"
|
|
]
|
|
},
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBI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AoCgCAQFEAAASKAgAgUBQAAIGiAAAIFAUAQKAoAADC/wDhg9/NICpwtwAAAABJRU5ErkJggg==\n",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"plt.imshow(patch, cmap='gray')\n",
|
|
"plt.axis('off')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"id": "657391f6-0846-4fda-b1d2-4d4a9e9fe472",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"binary = np.array(patch * 255., np.uint8)\n",
|
|
"_, binary = cv2.threshold(binary, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"id": "c11519a3-2816-4b3e-abf8-f0215a7f6d0a",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"(-0.5, 63.5, 63.5, -0.5)"
|
|
]
|
|
},
|
|
"execution_count": 12,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAHPklEQVR4nO3dyY7jRhBAwZYx///L9MnPhlsci24uVWTEeQ5sLXhIVE7ptSzL8gUAX19ff1z9AACMQxQAiCgAEFEAIKIAQEQBgIgCABEFAPLr03/4er2OfA4ADvbJ/1U2KQAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgB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wADMCkAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoAJA/AQdJ63UDeDO+AAAAAElFTkSuQmCC\n",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"plt.imshow(binary, cmap='gray')\n",
|
|
"plt.axis('off')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"id": "151c330e-6274-4021-97d7-2273cb1ddce9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"centers = []\n",
|
|
"mask = np.zeros(binary.shape)\n",
|
|
"\n",
|
|
"labeled_img = label(binary)\n",
|
|
"rps = regionprops(labeled_img)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 23,
|
|
"id": "9a5c998a-9747-4c41-9bf3-88afd6afa307",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def hough_center_detection(i, rp, labeled_img, img_size=2048):\n",
|
|
" hs, ws, he, we = rp.bbox\n",
|
|
" hs = np.clip(hs - 8, 0, img_size-1)\n",
|
|
" ws = np.clip(ws - 8, 0, img_size-1)\n",
|
|
" he = np.clip(he + 8, 0, img_size-1)\n",
|
|
" we = np.clip(we + 8, 0, img_size-1)\n",
|
|
"\n",
|
|
" m = np.array(labeled_img == rp.label, np.uint8)[hs:he, ws:we]\n",
|
|
" m = cv2.dilate(m, np.ones((3, 3))) \n",
|
|
" \n",
|
|
" cricles = cv2.HoughCircles(\n",
|
|
" m,\n",
|
|
" method = cv2.HOUGH_GRADIENT,\n",
|
|
" dp = 1,\n",
|
|
" minDist = 13,\n",
|
|
" minRadius = 5,\n",
|
|
" maxRadius = 12,\n",
|
|
" param1 = 5,\n",
|
|
" param2 = 6,\n",
|
|
" )\n",
|
|
" \n",
|
|
" if cricles is None:\n",
|
|
" return np.array([])\n",
|
|
" \n",
|
|
" if (rp.area > 400) & (cricles.shape[1] != 2):\n",
|
|
" print(i, cricles.shape[1])\n",
|
|
" \n",
|
|
" print(cricles[0], cricles[0][:, :2][:, ::-1] + [hs, ws])\n",
|
|
" \n",
|
|
" centers = np.round(cricles[0][:, :2][:, ::-1] + [hs, ws])\n",
|
|
" centers = np.array(centers, np.int32)\n",
|
|
" \n",
|
|
" return centers"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 24,
|
|
"id": "f18c9429-0f1e-4f59-8207-4ea9b5d43db9",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[[16.5 12.5 10.3]\n",
|
|
" [31.5 18.5 11.4]] [[12.5 31.5]\n",
|
|
" [18.5 46.5]]\n",
|
|
"[[ 9.5 17.5 10.2]] [[17.5 9.5]]\n",
|
|
"[[16.5 15.5 9.6]] [[36.5 51.5]]\n",
|
|
"[[13.5 18.5 11.4]] [[41.5 13.5]]\n",
|
|
"[[15.5 16.5 10.3]] [[51.5 31.5]]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for i, rp in enumerate(rps):\n",
|
|
" if rp.area < 48:\n",
|
|
" continue\n",
|
|
"\n",
|
|
" rp_centers = hough_center_detection(i, rp, labeled_img)\n",
|
|
"\n",
|
|
" if len(rp_centers) == 0:\n",
|
|
" h, w = np.array(np.round(rp.centroid), np.int32)\n",
|
|
" mask[h, w] = 1\n",
|
|
" else:\n",
|
|
" for h, w in rp_centers:\n",
|
|
" mask[h, w] = 1"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 33,
|
|
"id": "e0637ceb-1c56-4352-a56c-eaf1dbf9938c",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"h, w = np.array([12, 18, 18, 36, 42, 52]), np.array([32, 10, 46, 52, 14, 32])\n",
|
|
"r = np.round(np.array([10.3, 11.4, 10.2, 9.6, 11.4, 10.3]))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 34,
|
|
"id": "acc6a59f-db70-4532-80c6-4993fcc262a7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from PIL import Image"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"id": "d95be2e4-122f-436a-9907-33495556afc1",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"(-0.5, 63.5, 63.5, -0.5)"
|
|
]
|
|
},
|
|
"execution_count": 37,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAQm0lEQVR4nO3dP4xd1Z0H8PNmLGENxhiCPeO4QNGuCwzNGkQklEhJFiE3UJIm2qRitdWuaDA0iCZrGpRUUaiyq22SEhqE2OxKWSHFAqfhT+GNEAVrY2fBGGOBxMzbYjy/9YzvMe947v/7+Uiv8PPVe+fdP+87553fPWc2n8/nCQBSSktdNwCA/hAKAAShAEAQCgAEoQBAEAoABKEAQBAKAIQ9i244m82abAcADVvkXmU9BQCCUAAgCAUAglAAIAgFAIJQACAIBQCCUAAgCAUAglAAIAgFAMLCcx/B2OVmhTHrF1OipwBAEAoABKEAQBAKAAQDzQzKNy8RcutyA8pdvCd0RU8BgCAUAAhCAYAgFAAIQgGAoPqITpVW9nRRrdPke5Z8fpVKtEFPAYAgFAAIQgGAIBQACEIBgKD6iNZUVdrUVVEznzc5Q1H7ZrMb94xFgGiDngIAQSgAEIQCAEEoABCEAgBB9RG1K6mSGVvVUF1K9su8olIpJVVJ3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yubnDf1vHKxXMiDXBOqLN/fDO98tLPs///xNPPjScYMufbNK7waVvk2jSmwORtbKyn3//m5Ztu8x//8nLa2FhvqUXQHaHA5H30/rvbfjKq8vn//iV99P67LbUIuiMUmLwrlz6tdTsYMqHA5O07cFet28GQqT7aocnBttyUG30f4Bv7IjtH7rs/7bv7npv+hHTHt+5JR+67v8VW1WCg5xvd0lNg8paWltOPfvbUTbf54U+fcr8Ck6AktUWlpZ19lz1xBliSmlL1fQp3fOue9MOfDvQ+BT0Fdljk614otEgo9N+o7mgWCuwgFHpGKNAqocAObl4DoIjqoxb5Cw3oOz0FAIJQACAIBQCCUAAgCAUAguojape7p2WIi+/A1OgpABCEAgBBKAAQhAIAQSgAEIQCAEEoABCEAgBBKAAQhAIAQSgAEMx9xC3LrSSXXYu6Yk4k8yHVwFrM1EhPAYAgFAAIQgGAIBQACEIBgCAUAAhCAYAgFAAIQgGAIBQACKa5oHYl019UTX2RkukvKpnOghboKQAQhAIAQSgAEIQCAEEoABBUH9GaqiqZbI1RptImja0qKfc5qzZtsBmwRU8BgCAUAAhCAYAgFAAIQgGAoPqITpVW1MwLqnVKlczZ1PR7Qlf0FAAIQgGAIBQACEIBgGCgmUFpcmA2N6BsMJgp0VMAIAgFAIJQACAIBQCCUAAgqD6Ca1QZgZ4CANcRCgAEoQBAEAoABKEAQFi4+mg+b3KpEQD6QE8BgCAUAAhCAYAgFAAIQgGAIBQACEIBgCAUAAhCAYDwf5Iel7Ks0KkBAAAAAElFTkSuQmCC\n",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"bbrgb = np.array(Image.fromarray(binary).convert('RGB'))\n",
|
|
"\n",
|
|
"for i in range(len(h)):\n",
|
|
" cv2.circle(bbrgb, (w[i], h[i]), int(r[i]), [255, 0, 0])\n",
|
|
" plt.scatter(w[i], h[i])\n",
|
|
" \n",
|
|
"plt.imshow(bbrgb, cmap='gray')\n",
|
|
"plt.axis('off')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "58ebe6a1-62fd-4188-8da1-c7758b6c6978",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "4104cebe-15cf-4b67-97da-91cd9f5c9ee1",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "cmae",
|
|
"language": "python",
|
|
"name": "cmae"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.16"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|