Search in sources :

Example 1 with DeepDream

use of com.simiacryptus.mindseye.applications.DeepDream in project MindsEye by SimiaCryptus.

the class DeepDream_VGG19 method run.

/**
 * Test.
 *
 * @param log the log
 */
public void run(@Nonnull NotebookOutput log) {
    DeepDream<MultiLayerVGG19.LayerType, MultiLayerVGG19> dreamBase = new DeepDream.VGG19();
    init(log);
    Precision precision = Precision.Float;
    int imageSize = 800;
    String lakeAndForest = "H:\\SimiaCryptus\\Artistry\\Owned\\IMG_20170624_153541213-EFFECTS.jpg";
    CharSequence vanGogh = "H:\\SimiaCryptus\\Artistry\\portraits\\picasso\\800px-Pablo_Picasso,_1921,_Nous_autres_musiciens_(Three_Musicians),_oil_on_canvas,_204.5_x_188.3_cm,_Philadelphia_Museum_of_Art.jpg";
    CharSequence threeMusicians = "H:\\SimiaCryptus\\Artistry\\portraits\\picasso\\800px-Pablo_Picasso,_1921,_Nous_autres_musiciens_(Three_Musicians),_oil_on_canvas,_204.5_x_188.3_cm,_Philadelphia_Museum_of_Art.jpg";
    Map<MultiLayerVGG19.LayerType, DeepDream.ContentCoefficients> contentCoefficients = new HashMap<>();
    contentCoefficients.put(MultiLayerVGG19.LayerType.Layer_1d, new DeepDream.ContentCoefficients(0, 1e-1));
    // contentCoefficients.put(MultiLayerVGG19.LayerType.Layer_1e, new ContentCoefficients(0, 1e0));
    contentCoefficients.put(MultiLayerVGG19.LayerType.Layer_2b, new DeepDream.ContentCoefficients(0, 1e0));
    contentCoefficients.put(MultiLayerVGG19.LayerType.Layer_3a, new DeepDream.ContentCoefficients(0, 1e1));
    int trainingMinutes = 180;
    log.h1("Phase 0");
    BufferedImage canvasImage = ArtistryUtil.load(lakeAndForest, imageSize);
    // canvasImage = randomize(canvasImage);
    canvasImage = TestUtil.resize(canvasImage, imageSize, true);
    BufferedImage contentImage = ArtistryUtil.load(lakeAndForest, canvasImage.getWidth(), canvasImage.getHeight());
    dreamBase.deepDream(server, log, canvasImage, new DeepDream.StyleSetup(precision, contentImage, contentCoefficients), trainingMinutes);
    log.setFrontMatterProperty("status", "OK");
}
Also used : VGG19(com.simiacryptus.mindseye.models.VGG19) MultiLayerVGG19(com.simiacryptus.mindseye.models.MultiLayerVGG19) HashMap(java.util.HashMap) BufferedImage(java.awt.image.BufferedImage) MultiLayerVGG19(com.simiacryptus.mindseye.models.MultiLayerVGG19) Precision(com.simiacryptus.mindseye.lang.cudnn.Precision) DeepDream(com.simiacryptus.mindseye.applications.DeepDream)

Aggregations

DeepDream (com.simiacryptus.mindseye.applications.DeepDream)1 Precision (com.simiacryptus.mindseye.lang.cudnn.Precision)1 MultiLayerVGG19 (com.simiacryptus.mindseye.models.MultiLayerVGG19)1 VGG19 (com.simiacryptus.mindseye.models.VGG19)1 BufferedImage (java.awt.image.BufferedImage)1 HashMap (java.util.HashMap)1