コード例 #1
0
    return cross_entropy


model = VGG19(3)
# model  =ResNet50(3)
opt = keras.optimizers.Adam(learning_rate=0.0001)

# opt = keras.optimizers.SGD(learning_rate=1,momentum=0.001)
model.compile(optimizer=opt,
              loss="categorical_crossentropy",
              metrics='accuracy')
# model.compile(optimizer =opt, loss=weighted_categorical_crossentropy, metrics='accuracy')

model.summary()

dt = DataLoader()
X_Data, Y_Data = dt.LoadTrainingData(
    "D:\Sergey\FluorocodeMain\FluorocodeMain\DataForTraining.npz")
x_v, y_v = dt.LoadTrainingData(
    "D:\Sergey\FluorocodeMain\FluorocodeMain\DataForValidation.npz")

history = model.fit(X_Data,
                    Y_Data,
                    batch_size=4,
                    shuffle=True,
                    epochs=100,
                    validation_data=(x_v, y_v))

plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])
plt.title('Model accuracy')
コード例 #2
0
pixelsz = 39.68
ResEnhancement = 2
# genomes = ['Other','CP014051','CP039296','CP000948']
# genomes = ['NC_000913.3','Other','CP014051','CP014787']
genomes = ['NC_000913.3', 'CP014051', 'CP014787', 'NZ_CP009467.1']

# genomes = ['CP014787']
# genomes = ['CP000948']
# genomes = ['CP014051','CP039296', 'CP009467.1','CP014787','CP000948']

AllLabels = []
AllProfiles = []
numsamples = 5000

Dt = DataConverter()
Ds = DataLoader()

for genome in genomes:
    EffLabeledTraces = []
    SIMTRC = SIMTraces.TSIMTraces(genome, 1.66, 0.34, 0, 'TaqI', pixelsz)
    Gauss = Misc.GetGauss1d(
        size, Misc.FWHMtoSigma(Misc.GetFWHM(Wavelength, NA, ResEnhancement)),
        pixelsz)

    if genome != 'Other':

        Profiles = []
        ReCuts = SIMTRC.GetTraceRestrictions()
        ReCutsInPx = SIMTRC.GetDyeLocationsInPixel(ReCuts)
        R = RTG.RandomTraceGenerator(Misc.kbToPx(100000, SIMTRC),
                                     Misc.kbToPx(20000, SIMTRC), numsamples)