我正在使用ImageDataGenerator训练一个简单的CNN,一点也不花哨。模型针对第一个纪元进行训练,最后我得到以下错误消息:
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'ImageDataGenerator' object has no attribute 'shape'
有趣的是,如果我在r-reticulate
环境中使用python运行一个等效示例,一切正常。
这是来自jupyter的一些信息:
sys.executable C:\Users\edo\Anaconda3\envs\r-reticulate\python.exe
sys.version 3.6.7 (default, Jul 2 2019, 02:21:41) [MSC v.1900 64 bit (AMD64)]
sys.version_info sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)
tf.__version__ 1.13.1
tf.__file__ C:\Users\edo\Anaconda3\envs\r-reticulate\lib\site-packages\tensorflow\__init__.py
np.__version__ 1.17.1
np.__file__ C:\Users\edo\Anaconda3\envs\r-reticulate\lib\site-packages\numpy\__init__.py
这是Rstudio的信息:
> reticulate::py_config()
python: C:\Users\edo\Anaconda3\envs\r-reticulate\python.exe
libpython: C:/Users/edo/Anaconda3/envs/r-reticulate/python36.dll
pythonhome: C:\Users\edo\ANACON~1\envs\R-RETI~1
version: 3.6.7 (default, Jul 2 2019, 02:21:41) [MSC v.1900 64 bit (AMD64)]
Architecture: 64bit
numpy: C:\Users\edo\ANACON~1\envs\R-RETI~1\lib\site-packages\numpy
numpy_version: 1.17.1
tensorflow: C:\Users\edo\ANACON~1\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p
python versions found:
C:\Users\edo\Anaconda3\envs\r-reticulate\python.exe
C:\Users\edo\ANACON~1\python.exe
C:\PYTHON~1\\python.exe
C:\PROGRA~2\MICROS~1\Shared\PYTHON~1\\python.exe
C:\Users\edo\Anaconda3\python.exe
C:\Users\edo\Anaconda3\envs\py2\python.exe
C:\Users\wangk\Anaconda3\python.exe
> tf_config()
TensorFlow v1.13.1 (C:\Users\edo\ANACON~1\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p)
Python v3.6 (C:\Users\edo\Anaconda3\envs\r-reticulate\python.exe)
> devtools::session_info()
- Session info -----------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.6.0 (2019-04-26)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz Europe/Berlin
date 2019-08-27
- Packages ---------------------------------------------------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
backports 1.1.4 2019-04-10 [1] CRAN (R 3.6.0)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.6.0)
callr 3.3.1 2019-07-18 [1] CRAN (R 3.6.1)
cli 1.1.0 2019-03-19 [1] CRAN (R 3.6.0)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.1)
devtools 2.1.0 2019-07-06 [1] CRAN (R 3.6.1)
digest 0.6.20 2019-07-04 [1] CRAN (R 3.6.1)
fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.1)
generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.1)
glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.0)
jsonlite 1.6 2018-12-07 [1] CRAN (R 3.6.0)
keras * 2.2.4.1 2019-04-05 [1] CRAN (R 3.6.1)
knitr 1.23 2019-05-18 [1] CRAN (R 3.6.0)
lattice 0.20-38 2018-11-04 [2] CRAN (R 3.6.0)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
Matrix 1.2-17 2019-03-22 [2] CRAN (R 3.6.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.1)
pkgbuild 1.0.5 2019-08-26 [1] CRAN (R 3.6.0)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.1)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.6.1)
processx 3.4.1 2019-07-18 [1] CRAN (R 3.6.1)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.6.1)
R6 2.4.0 2019-02-14 [1] CRAN (R 3.6.0)
Rcpp 1.0.1 2019-03-17 [1] CRAN (R 3.6.0)
remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.1)
reticulate 1.13 2019-07-24 [1] CRAN (R 3.6.1)
rlang 0.4.0 2019-06-25 [1] CRAN (R 3.6.0)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
rstudioapi 0.10 2019-03-19 [1] CRAN (R 3.6.0)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
tensorflow * 1.14.0 2019-08-01 [1] CRAN (R 3.6.1)
testthat 2.2.1 2019-07-25 [1] CRAN (R 3.6.1)
tfruns 1.4 2018-08-25 [1] CRAN (R 3.6.1)
usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
whisker 0.3-2 2013-04-28 [1] CRAN (R 3.6.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
xfun 0.8 2019-06-25 [1] CRAN (R 3.6.0)
zeallot 0.1.0 2018-01-28 [1] CRAN (R 3.6.0)
[1] C:/Users/edo/R/win-library/3.6
[2] C:/Program Files/R/R-3.6.0/library