-
Notifications
You must be signed in to change notification settings - Fork 281
Feature/flow images from dataframe #725
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
Feature/flow images from dataframe #725
Conversation
|
|
||
| test_succeeds("flow images from dataframe works", { | ||
|
|
||
| if (!reticulate::py_module_available("pandas")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the function itself requires pandas we should note this in the documentation (and also do a check during the call to print a clear error message to that effect). Note that pandas will generally not be installed in TF environments installed via install_tensorflow() without special extra effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks JJ! I added a note to the docs here: https://github.com/rstudio/keras/pull/725/files#diff-151c30ec9c406dc7d593b4eeca5113a3R890 and I'll catch the error to print a clear message here: https://github.com/rstudio/keras/pull/725/files#diff-151c30ec9c406dc7d593b4eeca5113a3R910
R/preprocessing.R
Outdated
|
|
||
| if (!reticulate::py_module_available("pandas")) | ||
| stop("Pandas (python module) must be installed in the same environment as Keras.", | ||
| '. Install it using reticulate::py_install("pandas", envname = "r-tensorflow").') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does leave open whether they used virtualenv or condaenv to install (the code above will default to virtualenv).
They could also do this: install_tensorflow(extra_packages = "pandas"). Not sure if that's a better thing to document or not though (will leave that to your discretion!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I thnk it's better now: 643bca3#diff-151c30ec9c406dc7d593b4eeca5113a3R914
|
Okay, that looks great!
…On Wed, Apr 3, 2019 at 1:15 PM Daniel Falbel ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In R/preprocessing.R
<#725 (comment)>:
> +#' @section Yields: `(x, y)` where `x` is an array of image data and `y` is a
+#' array of corresponding labels. The generator loops indefinitely.
+#'
+#' @family image preprocessing
+#' @export
+flow_images_from_dataframe <- function(
+ dataframe, directory = NULL, x_col = "filename", y_col = "class",
+ generator = image_data_generator(), target_size = c(256,256),
+ color_mode = "rgb", classes = NULL, class_mode = "categorical",
+ batch_size = 32, shuffle = TRUE, seed = NULL, save_to_dir = NULL,
+ save_prefix = "", save_format = "png", subset = NULL,
+ interpolation = "nearest", drop_duplicates = TRUE) {
+
+ if (!reticulate::py_module_available("pandas"))
+ stop("Pandas (python module) must be installed in the same environment as Keras.",
+ '. Install it using reticulate::py_install("pandas", envname = "r-tensorflow").')
Ok, I thnk it's better now: 643bca3
#diff-151c30ec9c406dc7d593b4eeca5113a3R914
<643bca3#diff-151c30ec9c406dc7d593b4eeca5113a3R914>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#725 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAGXx3kb4FcutAGyerkI95ghGCNcioZfks5vdOGhgaJpZM4cY7ij>
.
|
This will add
flow_images_from_dataframefunction. Fixing #658.Needs more testing before merging.