Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssd7 Model #16

Open
muschellij2 opened this issue Jan 30, 2020 · 4 comments
Open

Ssd7 Model #16

muschellij2 opened this issue Jan 30, 2020 · 4 comments

Comments

@muschellij2
Copy link
Contributor

createSsd7Model2D fails for 2D

library(ANTsRNet)
createSsd7Model2D(c(256, 256, 3), 2)
#> Error in py_call_impl(callable, dots$args, dots$keywords): ValueError: Duplicate node name in graph: 'packed'
#> 
#> Detailed traceback: 
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/keras/backend.py", line 3014, in tile
#>     return array_ops.tile(x, n)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 11293, in tile
#>     input, multiples, name=name, ctx=_ctx)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 11340, in tile_eager_fallback
#>     _attr_Tmultiples, (multiples,) = _execute.args_to_matching_eager([multiples], _ctx, _dtypes.int32)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/eager/execute.py", line 257, in args_to_matching_eager
#>     t, dtype, preferred_dtype=default_dtype, ctx=ctx))
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1296, in internal_convert_to_tensor
#>     ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 1278, in _autopacking_conversion_function
#>     return _autopacking_helper(v, dtype, name or "packed")
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 1214, in _autopacking_helper
#>     return gen_array_ops.pack(elems_as_tensors, name=scope)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 6304, in pack
#>     "Pack", values=values, axis=axis, name=name)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 793, in _apply_op_helper
#>     op_def=op_def)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 548, in create_op
#>     compute_device)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3429, in _create_op_internal
#>     op_def=op_def)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1773, in __init__
#>     control_input_ops)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1613, in _create_c_op
#>     raise ValueError(str(e))

Also fails for 3D

library(ANTsRNet)
createSsd7Model3D(c(256, 256, 100, 3), 2)
#> Error in py_call_impl(callable, dots$args, dots$keywords): ValueError: Negative dimension size caused by subtracting 3 from 1 for 'classes7_1/Conv3D' (op: 'Conv3D') with input shapes: [?,4,4,1,32], [3,3,3,32,10].
#> 
#> 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/layers/convolutional.py", line 197, in call
#>     outputs = self._convolution_op(inputs, self.kernel)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 1134, in __call__
#>     return self.conv_op(inp, filter)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 639, in __call__
#>     return self.call(inp, filter)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 238, in __call__
#>     name=self.name)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_nn_ops.py", line 1553, in conv3d
#>     dilations=dilations, name=name)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 793, in _apply_op_helper
#>     op_def=op_def)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 548, in create_op
#>     compute_device)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3429, in _create_op_internal
#>     op_def=op_def)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1773, in __init__
#>     control_input_ops)
#>   File "/Users/johnmuschelli/.virtualenvs/r-reticulate/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1613, in _create_c_op
#>     raise ValueError(str(e))

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) 
#>  rstudioapi    0.10.0-9003 2020-01-05 [1] Github (rstudio/rstudioapi@abe596d)
#>  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
@ntustison
Copy link
Member

Try this:

library( ANTsRNet )
library( tensorflow )

tf$compat$v1$disable_eager_execution()

createSsd7Model2D(c(250, 250, 3), 2)

createSsd7Model3D(c(250, 250, 250, 3), 2)

@muschellij2
Copy link
Contributor Author

muschellij2 commented Feb 3, 2020

Does that break other code? Worked for me, but found that disable_eager_execution caused errors elsewhere.

@ntustison
Copy link
Member

Where?

@muschellij2
Copy link
Contributor Author

Can't remember - let's see if R CMD check passes on https://travis-ci.org/ANTsX/ANTsRNet/builds/645515832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants