Code Monkey home page Code Monkey logo

Comments (1)

caseus-viridis avatar caseus-viridis commented on July 28, 2024

Hi Elena,

See below for a fix of the problem. Tested with neon 2.0.0.

Summary:

  • For the problem with Conv, changed constructor arguments dilation, padding and stride from tuple/list to dict.
  • For the problem with Pooling, cannot reproduce with neon 2.0.0. As far as this example is concerned, 3D pooling layer instantiated without an error.

Follow-up thoughts:

  • If you find the 3D Conv API unsatisfactory in this fix, please create an issue on the neon repo, we will try our best to address it and improve in future releases. Thanks!

As I do not have write access to this repo, I cannot generate a PR. Here is a fix of the problem in diff against commit 46cc923:

diff --git a/neon/gan3D.py b/neon/gan3D.py
index 9e21232..3c18149 100644
--- a/neon/gan3D.py
+++ b/neon/gan3D.py
@@ -1,3 +1,7 @@
+#!/usr/bin/env python
+"""
+A GAN using 3D conv layers
+"""
 import os
 from datetime import datetime
 from neon.callbacks.callbacks import Callbacks, GANCostCallback
@@ -41,7 +45,7 @@ D_layers = [Conv((5, 5, 5, 32), **conv1),
             Conv((5, 5, 5, 8), **conv3),
             Dropout(keep = 0.8),
 
-            #Pooling((2, 2, 2)),
+            Pooling((2, 2, 2)),
             # what's about the Flatten Layer?
             Linear(1, init=init)] #what's about the activation function?
 
@@ -49,14 +53,14 @@ D_layers = [Conv((5, 5, 5, 32), **conv1),
 # generator using covolution layers
 latent_size = 200
 relu = Rectlin(slope=0)  # relu for generator
-conv4 = dict(init=init, batch_norm=True, activation=lrelu, dilation=[2, 2, 2])
-conv5 = dict(init=init, batch_norm=True, activation=lrelu, padding=[2, 2, 0], dilation=[2, 2, 3])
-conv6 = dict(init=init, batch_norm=False, activation=lrelu, padding=[1, 0, 3])
+conv4 = dict(init=init, batch_norm=True, activation=lrelu, dilation=dict(dil_h=2, dil_w=2, dil_d=2))
+conv5 = dict(init=init, batch_norm=True, activation=lrelu, padding=dict(pad_h=2, pad_w=2, pad_d=0), dilation=dict(dil_h=2, dil_w=2, dil_d=3))
+conv6 = dict(init=init, batch_norm=False, activation=lrelu, padding=dict(pad_h=1, pad_w=0, pad_d=3))
 G_layers = [Linear(64 * 7 * 7, init=init), # what's about the input volume
-            Reshape((7, 7, 8, 8)), 
+            Reshape((7, 7, 8, 8)),
             Conv((6, 6, 8, 64), **conv4),
             Conv((6, 5, 8, 6), **conv5),
-            Conv((3, 3, 8, 6), **conv6), 
+            Conv((3, 3, 8, 6), **conv6),
             Conv((2, 2, 2, 1), init=init, batch_norm=False, activation=relu)]
             # what's about Embedding
 
@@ -65,6 +69,3 @@ layers = GenerativeAdversarial(generator=Sequential(G_layers, name="Generator"),
 
 # setup cost function as CrossEntropy
 cost = GeneralizedGANCost(costfunc=GANCost(func="modified"))
-
-
-

Best,
Xin

from 3dgan.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.