diff --git a/Machine_Learning_Final_Project_Image_Analysis.ipynb b/Machine_Learning_Final_Project_Image_Analysis.ipynb index 704066b..07c8a1d 100644 --- a/Machine_Learning_Final_Project_Image_Analysis.ipynb +++ b/Machine_Learning_Final_Project_Image_Analysis.ipynb @@ -32,10 +32,12 @@ "base_uri": "https://localhost:8080/", "height": 672 }, - "outputId": "2fee98d0-9d00-4ead-b762-44e35b2c7a46" + "outputId": "b12075c9-adb7-4e0e-d28f-e443b6683b9f" }, "source": [ + "\"\"\"Utilize histogram matching to normalize images? https://scikit-image.org/docs/stable/auto_examples/transform/plot_histogram_matching.html#sphx-glr-auto-examples-transform-plot-histogram-matching-py\"\"\"\n", "## For Image portion\n", + "\n", "from google.colab import drive\n", "drive.mount('/content/gdrive')\n", "from PIL import Image\n", @@ -58,9 +60,8 @@ "\n", "filename='HP-16_0.tif'\n", "im=io.imread(filename)\n", - "cropim=im[0:4095,0:6143]#.crop(0,0,6143,4095)\n", - "#im = array(Image.open(filename))\n", - "#plt.imshow(im, cmap=plt.cm.gray)\n", + "cropim=im[0:4095,0:6143] #for croping out scalebar\n", + "\n", "plt.imshow(cropim, cmap=plt.cm.gray)\n", "\n", "#noisy_image = img_as_ubyte(data.camera())\n", @@ -76,14 +77,14 @@ "\n", "plt.tight_layout()\n" ], - "execution_count": 22, + "execution_count": 4, "outputs": [ { "output_type": "stream", "text": [ - "Drive already mounted at /content/gdrive; to attempt to forcibly remount, call drive.mount(\"/content/gdrive\", force_remount=True).\n", + "Mounted at /content/gdrive\n", "posix\n", - "/content/gdrive/My Drive/PhD Image Processing/Processed Images/UAB/HP-16\n" + "/content\n" ], "name": "stdout" }, @@ -116,124 +117,69 @@ { "cell_type": "code", "metadata": { - "id": "hsd_fYYqohhi", + "id": "E0NJYOZFoK7r", "colab_type": "code", - "outputId": "eafefd0d-3b68-4d41-dde1-3a1022692e92", "colab": { "base_uri": "https://localhost:8080/", - "height": 34 - } + "height": 51 + }, + "outputId": "e81413e1-a0bf-4e5a-9d66-ee546e41516c" }, "source": [ - "from google.colab import drive\n", - "drive.mount('/content/gdrive')\n", - "import matplotlib.pyplot as plt\n", + "from skimage import data\n", + "from skimage.filters.rank import entropy\n", + "from skimage.morphology import disk\n", "import numpy as np\n", - "import pandas as pd\n", - "# importing os module \n", - "import os \n", - "from sklearn.ensemble import RandomForestClassifier\n", - "from sklearn.datasets import make_classification\n", - "\n", - "#Load in data\n", - "os.chdir(\"//content//gdrive//My Drive//PhD casting project//Summary files\")\n", - "\n", - "#filename='PhaseFraction.csv'\n", - "filename='DTAdata.csv'\n", - "\n", - "data = pd.read_csv(filename)\n", - "data.head\n", - "data.shape\n", - "#F_MC=data['Fraction MC E1']\n", - "\n", - "## Define Data of Interest\n", - "labels=data['Sample ID']\n", - "#F_Y_MC=data['Fraction Y E1']\n", - "#F_MC=data['Fraction MC E1']\n", - "#F_Y_M7=data['Fraction Y E2']\n", - "#F_M7=data['Fraction M7C3 E2']" - ], - "execution_count": 0, - "outputs": [ - { - "output_type": "stream", - "text": [ - "Drive already mounted at /content/gdrive; to attempt to forcibly remount, call drive.mount(\"/content/gdrive\", force_remount=True).\n" - ], - "name": "stdout" - } - ] - }, - { - "cell_type": "code", - "metadata": { - "id": "tbBL8aI11Oll", - "colab_type": "code", - "outputId": "e8053236-4919-4aae-ddd4-18bb0012976e", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 392 - } - }, - "source": [ - "# %% Visualize Data\n", - "plt.figure(figsize=(10,6))\n", - "plt.scatter(data['C'],data['Liquidus'])\n", - "plt.xlabel('Concentration (wt.%)')\n", - "plt.ylabel('Temperature (C)')\n", - "plt.show()\n", - "\n", + "import matplotlib.pyplot as plt\n", + "from skimage.util import img_as_ubyte\n", + "import skimage\n", "\n", - "#Random Forest?\n", + "#image = skimage.img_as_ubyte(cropim) #8 bit\n", + "image=cropim #16 bit\n", "\n", + "fig, ax = plt.subplots(ncols=2, figsize=(24, 12), sharex=True, sharey=True)\n", "\n", - "#X, y = make_classification(n_samples=1000, n_features=4,\n", - "# n_informative=2, n_redundant=0,\n", - "# random_state=0, shuffle=False)\n", - "#clf = RandomForestClassifier(n_estimators=100, max_depth=2,\n", - "# random_state=0)\n", - "#clf.fit(X, y) \n", + "fig.colorbar(ax[0].imshow(image, cmap=plt.cm.gray), ax=ax[0])\n", + "ax[0].set_title('Image')\n", "\n", + "fig.colorbar(ax[1].imshow(entropy(image, disk(5)), cmap=plt.cm.gray), ax=ax[1])\n", + "ax[1].set_title('Entropy')\n", "\n", - "#print(clf.feature_importances_)\n", + "for a in ax:\n", + " a.axis('off')\n", "\n", - "#print(clf.predict([[0, 0, 0, 0]]))" + "plt.tight_layout()" ], "execution_count": 0, "outputs": [ { - "output_type": "display_data", - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAm4AAAF3CAYAAAAcmcfdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X2UZXV95/v3x6bVEtFW6VG7ZQQd\nbC+K0lqSRNRA9NJoZqSDZhSd8SGTEBwZk/GuVrgYGGURyO2JM0nUa1AJNxPEOBFbRMfGBBHjXB+K\ndEs3SkfEByicSyu2xKTUpvneP84uOF3Uw6miTp3ap96vtXpxzm8/nO9xW12f/u3f/v1SVUiSJGn5\ne8igC5AkSVJvDG6SJEktYXCTJElqCYObJElSSxjcJEmSWsLgJkmS1BJ9C25JLk1yZ5LdXW0XJLkx\nyc4k1yRZ17Q/Osknk3wtyU1J3th1zIFm/51JrupXvZIkSctd+jWPW5IXAT8B/ryqntm0Paqq7m5e\nvwU4pqrOTPJ/Ao+uqrcnWQvsAZ5QVT9P8pOqemRfipQkSWqRvvW4VdX1wF1T2u7uensoMJkaCzgs\nSYBHNsfd06/aJEmS2uiQpf7AJBcCrwN+DJzUNL8HuAq4Az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kX06yi04Ye8Yc3+V5dG4H721qupzOeqMAPweubl7f\nMEMNTwT2dr3/QnP8i+gEsRc0n/HVBx56sKraWVW/2ITSpwDfp3PX+i+T/MWUHr876br1K2n5M7hJ\n6qebgOcu4Lifdb0+ABwyy74B/kPT+3RcVR1VVdfM8zw/bXq6SPJwOmPNXllVxwIfAB6+gO8waX/d\nvyj0TDVMTPmM64EXAscDnwbW0BnXNrV3bUbN7eV3ABcA59MZQ/cB4C1duz28+WxJLWFwk9RP19K5\nHXfGZEOSZzXjsr4AvKoZ07WWTu/SV2Y51x7giUme15znsCSHANuBNyVZ3bQ/Lcmhc9T1D8BhM2yb\nDFA/SPJI4JU9HPcV4JeTHN483HA6nR7EXn0D+BdTzvd84N6q+imd3sLfphPo5qp/0uuAT1fVXXTG\nu93b/HkE3BfsngB8Zx51Shqw2f4VK0kPSlVVkl8D/muStwM/pRMUfhf4W+CXgK8BBbytqv5XkqfP\ncK6fNw8w/EmSETo9RS8BPkjn9uPfNWFkL7B5unN0uQT4TJI7usa5TX7OviQfAHYD/4uDb09eBrw/\nyURT++Qx309yNvA5Oj2An6qqT8xRQ7frgT9Mkur4WZLbgC81279AJwzuat5/EvirJKcC/wF4DDBa\nVecBpDPVyRvo3EYGeDednrufA69p2p5LZ+zdPfOoU9KA5f4efEnSoCT5I+CTVfXXS/h5V1XV3yzF\n50laHN4qlaTl4feZYW65PtltaJPaxx43SZKklrDHTZIkqSUMbpIkSS1hcJMkSWoJg5skSVJLGNwk\nSZJa4v8Hv8y1PHe9SDgAAAAASUVORK5CYII=\n", - "text/plain": [ - "
" - ] - }, - "metadata": { - "tags": [] - } + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.6/dist-packages/skimage/filters/rank/generic.py:104: UserWarning: Bad rank filter performance is expected due to a large number of bins (65536), equivalent to an approximate bitdepth of 16.0.\n", + " \"bitdepth of {:.1f}.\".format(n_bins, np.log2(n_bins)))\n" + ], + "name": "stderr" } ] }, { "cell_type": "code", "metadata": { - "id": "7slpzDth25jB", + "id": "ZXbfLdIhrGTG", "colab_type": "code", "colab": {} }, "source": [ - "from sklearn.ensemble import RandomForestClassifier\n", - "from sklearn.datasets import make_classification\n", - "from sklearn.tree import DecisionTreeClassifier\n", - "\n", - "# Make a decision tree and train\n", - "tree = DecisionTreeClassifier(random_state=RSEED)\n", - "tree.fit(X, y)\n", + "#Edge Detection\n", + "im = np.zeros((256, 256))\n", + "im[64:-64, 64:-64] = 1\n", "\n", - "print(f'Model Accuracy: {tree.score(X, y)}')\n", + "im = ndimage.rotate(im, 15, mode='constant')\n", + "im = ndimage.gaussian_filter(im, 8)\n", "\n", - "Model Accuracy: 1.0" + "sx = ndimage.sobel(im, axis=0, mode='constant')\n", + "sy = ndimage.sobel(im, axis=1, mode='constant')\n", + "sob = np.hypot(sx, sy)" ], "execution_count": 0, "outputs": []