Posts

Showing posts from November 27, 2018

Custom preprocessing_function with tf.image.rgb_to_grayscale - ValueError: setting an array element with a...

Image
up vote 0 down vote favorite 1 I am trying to use a custom preprocessing function to convert RGB images to grayscale during training. As such, I try to use tf.image.rbg_to_grayscale for this. My function looks as following: def prep_data(x): x = tf.image.rgb_to_grayscale(x) return x datagen = ImageDataGenerator(preprocessing_function=prep_data,validation_split=0.15) The train_generator is defined using datagen.flow_from_dataframe(...) . Training without this custom function works just fine, however once I use it I get the following error: ValueError: setting an array element with a sequence. Judging from this answer here, I assume I need to change my input to rgb_to_grayscale , but I don't know what's the correct way of passing x to the function. Any idea on how to solve this?

Can't read 'httpOnly: false' Cookie

Image
up vote 0 down vote favorite I have an express server that has written a cookie, but I can not access it from the client side. I can see it in the Chrome dev tools, it is NOT marked as being httpOnly or Secure, yet when I try to access it via my React app or even just by typing document.cookie in the browser console, I get nothing. Right now the express server is running on Heroku, and my client side is localhost. I'm stumped. Here is my server side code that is setting the cookie: return res .status(200) .cookie('id_token', token, { httpOnly: false, path: '/', secure: false, maxAge: 400000 }) .json({ token: token }); reactjs express cookies