Skip to content

Commit

Permalink
Fix a few bugs detected using Cython
Browse files Browse the repository at this point in the history
  • Loading branch information
feranick committed Nov 15, 2024
1 parent d483556 commit 76cb5dd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions SpectraKeras/SpectraKeras_CNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,17 @@ def predict(testFile):
print(' ========================================================\n')

else:
pass
'''
print('\n ==========================================')
print('\033[1m' + ' Predicted value \033[0m(probability = ' + str(predProb) + '%)')
print(' ==========================================\n')
print(" 1:", str(predValue[0]),"%")
print(" 2:",str(predValue[1]),"%")
print(" 3:",str((predValue[1]/0.5)*(100-99.2-.3)),"%\n")
print(' ==========================================\n')

'''

if dP.plotActivations and not dP.useTFlitePred:
plotActivationsPredictions(R,model)

Expand Down Expand Up @@ -800,14 +803,14 @@ def printParam():
def plotActivationsTrain(model):
import matplotlib.pyplot as plt
import tensorflow as tf
dP = Conf()
if checkTFVersion("2.16.0"):
import tensorflow.keras as keras
else:
if dP.kerasVersion == 2:
import tf_keras as keras
else:
import keras
dP = Conf()
i = 0
for layer in model.layers:
if isinstance(layer, keras.layers.Conv2D):
Expand Down
2 changes: 2 additions & 0 deletions SpectraKeras/SpectraKeras_MLP.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,15 @@ def predict(testFile):
print(' ========================================================\n')

else:
'''
print('\n ==========================================')
print('\033[1m' + ' Predicted value \033[0m(probability = ' + str(predProb) + '%)')
print(' ==========================================\n')
print(" 1:", str(predValue[0]),"%")
print(" 2:",str(predValue[1]),"%")
print(" 3:",str((predValue[1]/0.5)*(100-99.2-.3)),"%\n")
print(' ==========================================\n')
'''

#************************************
# Batch Prediction
Expand Down
3 changes: 0 additions & 3 deletions SpectraKeras/libSpectraKeras.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ def __call__(self,x):
# MultiClassReductor
#************************************
class MultiClassReductor():
def __self__(self):
self.name = name

def fit(self,tc):
self.totalClass = tc.tolist()

Expand Down
3 changes: 3 additions & 0 deletions web/SpectraKeras-web/SpectraKeras_CNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,16 @@ def predict(testFile):
print(' ========================================================\n')

else:
pass
'''
print('\n ==========================================')
print('\n Predicted value (probability = ' + str(predProb) + '%)')
print(' ==========================================\n')
print(" 1:", str(predValue[0]),"%")
print(" 2:",str(predValue[1]),"%")
print(" 3:",str((predValue[1]/0.5)*(100-99.2-.3)),"%\n")
print(' ==========================================\n')
'''

if dP.plotActivations and not dP.useTFlitePred:
plotActivationsPredictions(R,model)
Expand Down

0 comments on commit 76cb5dd

Please sign in to comment.