Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/X-ray-Dawgz/XRayDawgz
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbiegaj committed Mar 18, 2020
2 parents 94f8dcc + 8ca816a commit b58d4bc
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 25 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file removed Images/BCC_test/Ag_google3.jpg
Binary file not shown.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="left">
<img src="https://github.com/X-ray-Dawgz/XRayDawgz/blob/master/banner.png" width="900">
<img src="https://github.com/X-ray-Dawgz/XRayDawgz/blob/master/icon/banner.png" width="900">
</p>


Expand Down Expand Up @@ -75,7 +75,7 @@ In all cases, the users will inputting the XRD pattern that they obtained into o

2. Use the following method to clone repo

- press the green botton <img src="https://github.com/X-ray-Dawgz/XRayDawgz/blob/master/icon.png" width="80"> at
- press the green botton <img src="https://github.com/X-ray-Dawgz/XRayDawgz/blob/master/icon/icon.png" width="80"> at
the home page of our repo, and choose "Download Zip".

- unzip the file and you would get the file name "XRayDawgz" in your path.
Expand All @@ -84,9 +84,9 @@ the home page of our repo, and choose "Download Zip".


## How to use our software
1.First, the user needs to prepare the XRD diagram pictures which they want to make the prediction. These pictures need to
1. First, the user needs to prepare the XRD diagram pictures which they want to make the prediction. These pictures need to

match our standard to test.
match our standard to test.

- The standard size is 372*288pxi
- the range of the diffraction angle(2θ) needs to be 0-80 degree
Expand Down
93 changes: 93 additions & 0 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"scrolled": true
},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'load_weights' from 'keras.models' (/opt/anaconda3/lib/python3.7/site-packages/keras/models.py)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-14-bc89f4016bf8>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mkeras\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mload_weights\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mh5\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mImportError\u001b[0m: cannot import name 'load_weights' from 'keras.models' (/opt/anaconda3/lib/python3.7/site-packages/keras/models.py)"
]
}
],
"source": [
"from keras.models import load_weights\n",
"model.h5"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CNN.ipynb\r\n",
"CNN_test_0312.ipynb\r\n",
"Image_Preprocess.ipynb\r\n",
"Image_Preprocess.py\r\n",
"\u001b[34mImages\u001b[m\u001b[m/\r\n",
"LICENSE\r\n",
"Most_Updated_CS_Classifier.ipynb\r\n",
"README.md\r\n",
"Untitled.ipynb\r\n",
"With_new_testset_Updated_CS_Classifier.ipynb\r\n",
"\u001b[34mXRayDawgz\u001b[m\u001b[m/\r\n",
"banner.png\r\n",
"best_model.h5\r\n",
"\u001b[34mcut_image\u001b[m\u001b[m/\r\n",
"\u001b[34mdocs\u001b[m\u001b[m/\r\n",
"environment.yml\r\n",
"package.json\r\n",
"requirements.txt\r\n",
"setup.py\r\n",
"\u001b[34mtest\u001b[m\u001b[m/\r\n",
"\u001b[34mtest 2\u001b[m\u001b[m/\r\n"
]
}
],
"source": [
"ls"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
File renamed without changes
File renamed without changes
21 changes: 0 additions & 21 deletions package.json

This file was deleted.

65 changes: 65 additions & 0 deletions prediction.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from tensorflow import keras\n",
"from eras.preprocessing import image\n",
"import os\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"new_model = keras.models.load_model('Model_92_86.h5')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def predict_image(path_to_image):\n",
" for file in os.listder(path_to_imege):\n",
" predic_img = image.load_img(path_to_imege = file, \n",
" target_size=(432,288))\n",
" predic_img = image.img_to_array(predict_img) \n",
" predic_img = np.expand_dims(predict_img,axis = 0)\n",
" result = new_model.predict(predict_img)\n",
" if np.round(result,0) == 0:\n",
" print(str(file) + 'is BCC') \n",
" else:\n",
" print(str(file) + 'is FCC') "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit b58d4bc

Please sign in to comment.