ANTsRNet icon indicating copy to clipboard operation
ANTsRNet copied to clipboard

Super resolution GAN Model

Open muschellij2 opened this issue 4 years ago • 0 comments

Default for SuperResolutionGanModel is bad for 64x64x3, but needs to be 112x112x3. Technically the product needs to be 25088/2 = 12544

library( keras )
library( ANTsRNet )

keras::backend()$clear_session()
ganModel <- SuperResolutionGanModel$new(lowResolutionImageSize = c( 112, 112, 3 ))
ganModel <- SuperResolutionGanModel$new(lowResolutionImageSize = c( 64, 64, 3 ))
#> Error in py_call_impl(callable, dots$args, dots$keywords): ValueError: Input 0 of layer dense_7 is incompatible with the layer: expected axis -1 of input shape to have value 25088 but received input with shape [None, 8192]
#> 
#> Detailed traceback: 
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 842, in __call__
#>     outputs = call_fn(cast_inputs, *args, **kwargs)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/sequential.py", line 256, in call
#>     return super(Sequential, self).call(inputs, training=training, mask=mask)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py", line 708, in call
#>     convert_kwargs_to_constants=base_layer_utils.call_context().saving)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py", line 860, in _run_internal_graph
#>     output_tensors = layer(computed_tensors, **kwargs)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 812, in __call__
#>     self.name)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/input_spec.py", line 213, in assert_input_compatibility
#>     ' but received input with shape ' + str(shape))

Created on 2020-01-30 by the reprex package (v0.3.0.9001)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.0 (2019-04-26)
#>  os       macOS Mojave 10.14.6        
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2020-01-30                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                            
#>  ANTsR         0.5.4.2    2019-11-14 [1] local                             
#>  ANTsRCore     0.7.3      2019-12-11 [1] Github (ANTsX/ANTsRCore@416d8f1)  
#>  ANTsRNet    * 1.1        2020-01-30 [1] local                             
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                    
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.0)                    
#>  base64enc     0.1-3      2015-07-28 [1] CRAN (R 3.6.0)                    
#>  cli           2.0.1      2020-01-08 [1] CRAN (R 3.6.0)                    
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                    
#>  digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.0)                    
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                    
#>  fansi         0.4.1      2020-01-08 [1] CRAN (R 3.6.0)                    
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                    
#>  generics      0.0.2      2018-11-29 [1] CRAN (R 3.6.0)                    
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                    
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                    
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)                    
#>  ITKR          0.5.2      2019-11-05 [1] Github (stnava/ITKR@fe97efa)      
#>  jsonlite      1.6        2018-12-07 [1] CRAN (R 3.6.0)                    
#>  keras       * 2.2.5.0    2019-10-08 [1] CRAN (R 3.6.0)                    
#>  knitr         1.26.1     2020-01-05 [1] Github (muschellij2/knitr@f5af631)
#>  lattice       0.20-38    2018-11-04 [1] CRAN (R 3.6.0)                    
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                    
#>  Matrix        1.2-17     2019-03-22 [1] CRAN (R 3.6.0)                    
#>  mvtnorm       1.0-11     2019-06-19 [1] CRAN (R 3.6.0)                    
#>  pillar        1.4.3      2019-12-20 [1] CRAN (R 3.6.0)                    
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 3.6.0)                    
#>  purrr         0.3.3      2019-10-18 [1] CRAN (R 3.6.0)                    
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)                    
#>  Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.0)                    
#>  RcppEigen     0.3.3.7.0  2019-11-16 [1] CRAN (R 3.6.0)                    
#>  reprex        0.3.0.9001 2020-01-05 [1] Github (tidyverse/reprex@5ae0b29) 
#>  reticulate    1.13       2019-07-24 [1] CRAN (R 3.6.0)                    
#>  rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.0)                    
#>  rmarkdown     2.0.7      2020-01-17 [1] Github (rstudio/rmarkdown@2faf16a)
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                    
#>  stringi       1.4.5      2020-01-11 [1] CRAN (R 3.6.0)                    
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                    
#>  styler        1.1.1      2019-05-06 [1] CRAN (R 3.6.0)                    
#>  tensorflow    2.0.0      2019-10-02 [1] CRAN (R 3.6.0)                    
#>  tfruns        1.4        2018-08-25 [1] CRAN (R 3.6.0)                    
#>  tibble        2.1.3      2019-06-06 [1] CRAN (R 3.6.0)                    
#>  whisker       0.4        2019-08-28 [1] CRAN (R 3.6.0)                    
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                    
#>  xfun          0.11       2019-11-12 [1] CRAN (R 3.6.0)                    
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                    
#>  zeallot       0.1.0      2018-01-28 [1] CRAN (R 3.6.0)                    
#> 
#> [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

muschellij2 avatar Jan 30 '20 16:01 muschellij2