Skip to content

Commit bc1e800

Browse files
committed
Add support for TF 2.16.1 stable, Ready for release.
1 parent 2e8a7aa commit bc1e800

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Machine learning software for rapid spectral analysis. While Raman spectra were
66
- DNNClassifier (TensorFlow, TensorFlow-Lite)
77
- Convolutional Neural Networks (TensorFlow, TensorFlow-Lite)
88
- Required libraries for prediction:
9-
- tensorflow (v.2.12 or higher - won't work with previous releases)
10-
- Optional: tensorflow-lite (v.2.11 and higher)
9+
- tensorflow (v2.13 or higher, v2.16.1 recommended)
10+
- Optional: tensorflow-lite (v2.13 and higher, v2.16.1 recommended)
1111
- Optional: [tensorflow-lite runtime](https://www.tensorflow.org/lite/guide/python)
1212
- Optional: tensorflow-lite runtime with [Coral EdgeTPU](https://coral.ai/docs/accelerator/get-started/)
1313

@@ -23,7 +23,7 @@ Installation
2323
## Installation from available wheel package
2424
If available from the main site, you can install SpectraKeras by running:
2525

26-
python3 -m pip install --upgrade spectrakeras-2023.12.22.3-py3-none-any.whl
26+
python3 -m pip install --upgrade spectrakeras-2024.03.08.1-py3-none-any.whl
2727

2828
SpectraKeras_CNN and Spectrakeras_MLP are available directly from the command line.
2929
NOTE: The Utilities in the `Utilities` folder are not included in the package, and can be run locally as needed.
@@ -50,7 +50,7 @@ This software requires Python (3.9 or higher). It has been tested with Python 3.
5050
pydot
5151
graphviz
5252
h5py
53-
tensorflow (>=2.12)
53+
tensorflow (>=2.13)
5454

5555
In addition, these packages may be needed depending on your platform (via ```apt-get``` in debian/ubuntu or ```port``` in OSX):
5656

@@ -62,9 +62,9 @@ These are found in Unix based systems using common repositories (apt-get for Deb
6262
[TensorFlow](https://www.tensorflow.org) is needed only if flag is activated. Instructions for Linux and MacOS can be found in [TensorFlow installation page](https://www.tensorflow.org/install/). Pip installation is the easiest way to get going. Tested with TensorFlow 2.x (2.15 or higher preferred). TF 2.15 is the currently supported release.
6363

6464
Inference can be carried out using the regular tensorflow, or using [tensorflow-lite](https://www.tensorflow.org/lite/) for [quantized models](https://www.tensorflow.org/lite/performance/post_training_quantization). Loading times of tflite (direct or via [tflite-runtime](https://www.tensorflow.org/lite/guide/python)) are significantly faster than tensorflow with minimal loss in accuracy. SpectraKeras provides an option to convert tensorflow models to quantized tflite models. TFlite models have been tested in Linux x86-64, arm7 (including Raspberry Pi3) and aarm64, MacOS, Windows.
65-
To use quantized models, TF 2.3 or higher is recommended.
65+
To use quantized models, TF 2.13 or higher is recommended.
6666

67-
Inference using the [Coral EdgeTPU](https://coral.ai/) [tensorflow-lite](https://www.tensorflow.org/lite/) requires the [libedgetpu](https://github.com/google-coral/libedgetpu) libraries compatible with the supported and current version of `tflite-runtime` (version 2.15.0 or less), which is also required (Instructions and binaries can be found [here](https://github.com/feranick/TFlite-builds). More information on installation of such libraries at [Coral EdgeTPU](https://coral.ai/).
67+
Inference using the [Coral EdgeTPU](https://coral.ai/) [tensorflow-lite](https://www.tensorflow.org/lite/) requires the [libedgetpu](https://github.com/google-coral/libedgetpu) libraries compatible with the supported and current version of `tflite-runtime` (version v2.13.0 or hiigher, v2.16.1 recommended), which is also required (Instructions and binaries can be found [here](https://github.com/feranick/TFlite-builds). More information on installation of such libraries at [Coral EdgeTPU](https://coral.ai/).
6868

6969
Usage (SpectraKeras)
7070
===================

SpectraKeras-web/SpectraKeras_CNN.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'''
44
**********************************************
55
* SpectraKeras_CNN Classifier and Regressor
6-
* v2024.03.03.1
6+
* v2024.03.08.1
77
* Uses: TensorFlow
88
* By: Nicola Ferralis <feranick@hotmail.com>
99
**********************************************
@@ -223,7 +223,7 @@ def main():
223223
def train(learnFile, testFile, flag):
224224
dP = Conf()
225225
import tensorflow as tf
226-
if checkTFVersion("2.15.99"):
226+
if checkTFVersion("2.16.0"):
227227
import tensorflow.keras as keras
228228
else:
229229
if dP.kerasVersion == 2:
@@ -791,7 +791,7 @@ def printParam():
791791
def plotActivationsTrain(model):
792792
import matplotlib.pyplot as plt
793793
import tensorflow as tf
794-
if checkTFVersion("2.15.99"):
794+
if checkTFVersion("2.16.0"):
795795
import tensorflow.keras as keras
796796
else:
797797
if dP.kerasVersion == 2:
@@ -824,7 +824,7 @@ def plotActivationsTrain(model):
824824
def plotActivationsPredictions(R, model):
825825
print(" Saving activation plots...\n")
826826
import matplotlib.pyplot as plt
827-
if checkTFVersion("2.15.99"):
827+
if checkTFVersion("2.16.0"):
828828
import tensorflow as tf
829829
import tensorflow.keras as keras
830830
else:

SpectraKeras-web/libSpectraKeras.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'''
33
**********************************************
44
* libSpectraKeas - Library for SpectraKeras
5-
* v2024.03.03.1
5+
* v2024.03.08.1
66
* Uses: TensorFlow
77
* By: Nicola Ferralis <feranick@hotmail.com>
88
**********************************************
@@ -87,14 +87,14 @@ def loadModel(dP):
8787
model = tflite.Interpreter(model_path=os.path.splitext(dP.model_name)[0]+'_edgetpu.tflite',
8888
experimental_delegates=[tflite.load_delegate(dP.edgeTPUSharedLib,{})])
8989
except:
90-
print(" Coral Edge TPU not found. Please make sure it's connected and Tflite-runtime is v2.11.1 or lower.")
90+
print(" Coral Edge TPU not found. Please make sure it's connected and Tflite-runtime matches the TF version that is installled.")
9191
else:
9292
model = tflite.Interpreter(model_path=os.path.splitext(dP.model_name)[0]+'.tflite')
9393
model.allocate_tensors()
9494
else:
9595
getTFVersion(dP)
9696
import tensorflow as tf
97-
if checkTFVersion("2.15.99"):
97+
if checkTFVersion("2.16.0"):
9898
import tensorflow.keras as keras
9999
else:
100100
if dP.kerasVersion == 2:
@@ -187,7 +187,7 @@ def representative_dataset_gen():
187187
#************************************
188188
def plotWeights(dP, En, A, model, type):
189189
import matplotlib.pyplot as plt
190-
if checkTFVersion("2.15.99"):
190+
if checkTFVersion("2.16.0"):
191191
import tensorflow as tf
192192
import tensorflow.keras as keras
193193
else:

SpectraKeras/SpectraKeras_CNN.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'''
44
**********************************************
55
* SpectraKeras_CNN Classifier and Regressor
6-
* v2024.03.03.1
6+
* v2024.03.08.1
77
* Uses: TensorFlow
88
* By: Nicola Ferralis <feranick@hotmail.com>
99
**********************************************
@@ -223,7 +223,7 @@ def main():
223223
def train(learnFile, testFile, flag):
224224
dP = Conf()
225225
import tensorflow as tf
226-
if checkTFVersion("2.15.99"):
226+
if checkTFVersion("2.16.0"):
227227
import tensorflow.keras as keras
228228
else:
229229
if dP.kerasVersion == 2:
@@ -791,7 +791,7 @@ def printParam():
791791
def plotActivationsTrain(model):
792792
import matplotlib.pyplot as plt
793793
import tensorflow as tf
794-
if checkTFVersion("2.15.99"):
794+
if checkTFVersion("2.16.0"):
795795
import tensorflow.keras as keras
796796
else:
797797
if dP.kerasVersion == 2:
@@ -824,7 +824,7 @@ def plotActivationsTrain(model):
824824
def plotActivationsPredictions(R, model):
825825
print(" Saving activation plots...\n")
826826
import matplotlib.pyplot as plt
827-
if checkTFVersion("2.15.99"):
827+
if checkTFVersion("2.16.0"):
828828
import tensorflow as tf
829829
import tensorflow.keras as keras
830830
else:

SpectraKeras/SpectraKeras_MLP.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'''
44
**********************************************
55
* SpectraKeras_MLP Classifier and Regressor
6-
* v2024.03.03.1
6+
* v2024.03.08.1
77
* Uses: TensorFlow
88
* By: Nicola Ferralis <feranick@hotmail.com>
99
**********************************************
@@ -199,7 +199,7 @@ def main():
199199
def train(learnFile, testFile):
200200
dP = Conf()
201201
import tensorflow as tf
202-
if checkTFVersion("2.15.99"):
202+
if checkTFVersion("2.16.0"):
203203
import tensorflow.keras as keras
204204
else:
205205
if dP.kerasVersion == 2:

SpectraKeras/libSpectraKeras.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'''
33
**********************************************
44
* libSpectraKeas - Library for SpectraKeras
5-
* v2024.03.03.1
5+
* v2024.03.08.1
66
* Uses: TensorFlow
77
* By: Nicola Ferralis <feranick@hotmail.com>
88
**********************************************
@@ -87,14 +87,14 @@ def loadModel(dP):
8787
model = tflite.Interpreter(model_path=os.path.splitext(dP.model_name)[0]+'_edgetpu.tflite',
8888
experimental_delegates=[tflite.load_delegate(dP.edgeTPUSharedLib,{})])
8989
except:
90-
print(" Coral Edge TPU not found. Please make sure it's connected and Tflite-runtime is v2.11.1 or lower.")
90+
print(" Coral Edge TPU not found. \n Please make sure it's connected and Tflite-runtime matches the TF version that is installled.")
9191
else:
9292
model = tflite.Interpreter(model_path=os.path.splitext(dP.model_name)[0]+'.tflite')
9393
model.allocate_tensors()
9494
else:
9595
getTFVersion(dP)
9696
import tensorflow as tf
97-
if checkTFVersion("2.15.99"):
97+
if checkTFVersion("2.16.0"):
9898
import tensorflow.keras as keras
9999
else:
100100
if dP.kerasVersion == 2:
@@ -187,7 +187,7 @@ def representative_dataset_gen():
187187
#************************************
188188
def plotWeights(dP, En, A, model, type):
189189
import matplotlib.pyplot as plt
190-
if checkTFVersion("2.15.99"):
190+
if checkTFVersion("2.16.0"):
191191
import tensorflow as tf
192192
import tensorflow.keras as keras
193193
else:

SpectraKeras/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include = [
99

1010
[project]
1111
name = "SpectraKeras"
12-
version = "v2024.03.03.1"
12+
version = "v2024.03.08.1"
1313
dependencies = ["numpy", "h5py", "tensorflow", "pydot", "graphviz","scipy","tf-keras"]
1414
authors = [{ name="Nicola Ferralis", email="ferralis@mit.edu" },]
1515
description = "Machine learning for scientific spectra"

0 commit comments

Comments
 (0)