From dc5c65eed1f3ca96324d2e057cd7d815cd4a2df5 Mon Sep 17 00:00:00 2001 From: nunzip Date: Wed, 6 Mar 2019 13:56:06 +0000 Subject: Update on old commit for training the classifier in steps --- lenet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lenet.py b/lenet.py index c1c27b5..cae1afa 100644 --- a/lenet.py +++ b/lenet.py @@ -101,7 +101,7 @@ def plot_history(history, metric = None): plt.ylabel('Loss') plt.xlabel('Epoch') -def train_classifier(x_train, y_train, x_val, y_val, batch_size=128, epochs=100, metrics=[categorical_accuracy], optimizer = None): +def train_classifier(x_train, y_train, x_val, y_val, batch_size=128, epochs=100, metrics=[categorical_accuracy], optimizer = None, keep_training = False): shape = (32, 32, 1) # Pad data to 32x32 (MNIST is 28x28) @@ -114,10 +114,12 @@ def train_classifier(x_train, y_train, x_val, y_val, batch_size=128, epochs=100, optimizer = optimizers.SGD(lr=0.001, decay=1e-6, momentum=0.9, nesterov=True) model.compile(loss='categorical_crossentropy', metrics=metrics, optimizer=optimizer) - + if keep_training: + model.load_weights('./weights.h5') history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1, validation_data = (x_val, y_val)) plot_history(history, 'categorical_accuracy') plot_history(history) + model.save_weights('./weights.h5') return model def test_classifier(model, x_test, y_true): -- cgit v1.2.3-54-g00ecf From 40217bbe2fdb1db26c033ea27ceba83b04effb34 Mon Sep 17 00:00:00 2001 From: nunzip Date: Wed, 6 Mar 2019 15:58:46 +0000 Subject: Add figures --- report/fig/generic_gan_loss.png | Bin 0 -> 32275 bytes report/fig/generic_gan_mode_collapse.pdf | Bin 0 -> 205946 bytes report/fig/mix.png | Bin 0 -> 20008 bytes report/fig/mix_scores.PNG | Bin 0 -> 6133 bytes report/fig/mix_zoom.png | Bin 0 -> 23623 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 report/fig/generic_gan_loss.png create mode 100644 report/fig/generic_gan_mode_collapse.pdf create mode 100644 report/fig/mix.png create mode 100644 report/fig/mix_scores.PNG create mode 100644 report/fig/mix_zoom.png diff --git a/report/fig/generic_gan_loss.png b/report/fig/generic_gan_loss.png new file mode 100644 index 0000000..701b191 Binary files /dev/null and b/report/fig/generic_gan_loss.png differ diff --git a/report/fig/generic_gan_mode_collapse.pdf b/report/fig/generic_gan_mode_collapse.pdf new file mode 100644 index 0000000..fef0c9b Binary files /dev/null and b/report/fig/generic_gan_mode_collapse.pdf differ diff --git a/report/fig/mix.png b/report/fig/mix.png new file mode 100644 index 0000000..3cc03bc Binary files /dev/null and b/report/fig/mix.png differ diff --git a/report/fig/mix_scores.PNG b/report/fig/mix_scores.PNG new file mode 100644 index 0000000..85d3a4f Binary files /dev/null and b/report/fig/mix_scores.PNG differ diff --git a/report/fig/mix_zoom.png b/report/fig/mix_zoom.png new file mode 100644 index 0000000..0e40cab Binary files /dev/null and b/report/fig/mix_zoom.png differ -- cgit v1.2.3-54-g00ecf From 8842630c10bc302c5961ed7a763fcbd6282449cb Mon Sep 17 00:00:00 2001 From: nunzip Date: Wed, 6 Mar 2019 20:37:42 +0000 Subject: Add dcgan figures --- report/fig/large_dcgan_ex.pdf | Bin 0 -> 329497 bytes report/fig/long_dcgan.png | Bin 0 -> 18557 bytes report/fig/med_dcgan.png | Bin 0 -> 18041 bytes report/fig/med_dcgan_ex.pdf | Bin 0 -> 363034 bytes report/fig/short_dcgan.png | Bin 0 -> 22431 bytes report/fig/short_dcgan_ex.pdf | Bin 0 -> 327312 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 report/fig/large_dcgan_ex.pdf create mode 100644 report/fig/long_dcgan.png create mode 100644 report/fig/med_dcgan.png create mode 100644 report/fig/med_dcgan_ex.pdf create mode 100644 report/fig/short_dcgan.png create mode 100644 report/fig/short_dcgan_ex.pdf diff --git a/report/fig/large_dcgan_ex.pdf b/report/fig/large_dcgan_ex.pdf new file mode 100644 index 0000000..9dac5e5 Binary files /dev/null and b/report/fig/large_dcgan_ex.pdf differ diff --git a/report/fig/long_dcgan.png b/report/fig/long_dcgan.png new file mode 100644 index 0000000..4e12495 Binary files /dev/null and b/report/fig/long_dcgan.png differ diff --git a/report/fig/med_dcgan.png b/report/fig/med_dcgan.png new file mode 100644 index 0000000..9a809c9 Binary files /dev/null and b/report/fig/med_dcgan.png differ diff --git a/report/fig/med_dcgan_ex.pdf b/report/fig/med_dcgan_ex.pdf new file mode 100644 index 0000000..1acbd71 Binary files /dev/null and b/report/fig/med_dcgan_ex.pdf differ diff --git a/report/fig/short_dcgan.png b/report/fig/short_dcgan.png new file mode 100644 index 0000000..ea8199b Binary files /dev/null and b/report/fig/short_dcgan.png differ diff --git a/report/fig/short_dcgan_ex.pdf b/report/fig/short_dcgan_ex.pdf new file mode 100644 index 0000000..d12fa5b Binary files /dev/null and b/report/fig/short_dcgan_ex.pdf differ -- cgit v1.2.3-54-g00ecf