Created
July 22, 2021 06:13
-
-
Save therealnaveenkamal/bdc95c6f3890ae21014d48c630bb696a to your computer and use it in GitHub Desktop.
This code is for building up the CXR Disease classification model using the Dense121 layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = DenseNet121(weights='densenet.hdf5', include_top=False) | |
model = Model(inputs=model.input, outputs=Dense(len(labels), activation="sigmoid")(GlobalAveragePooling2D()(model.output))) | |
model.compile(optimizer='adam', loss=calcloss(negative_freqs, positive_freqs)) | |
fitter = model.fit(traingenerator, validation_data=valgenerator, steps_per_epoch = 1000, epochs = 50) | |
model.save_weights("cxr_naveen.h5") | |
plt.plot(fitter.history['loss']) | |
plt.ylabel("loss") | |
plt.xlabel("epoch") | |
plt.title("Training Loss Curve") | |
plt.show() | |
predicted_vals = model.predict(testgenerator, steps = len(testgenerator)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment