0

I am using google-api-php-client-services to train my data of my PHP website in google cloud. How do I do preprocessing in https://cloud.google.com/blog/big-data/2016/12/how-to-classify-images-with-tensorflow-using-google-cloud-machine-learning-and-cloud-dataflow using this library?

Is there any alternative to google-api-php-client to interact with ml_engine in PHP?

1 Answers1

0

That is the only client library available for CMLE. But that client library only provides PHP wrappers for Google Cloud APIs such as CMLE's API

The actual preprocessing done in the blog post is written as a Dataflow job in Python. As the blog post describes to run it you have to execute a Python program.

You won't be able to write your Dataflow job using PHP.

Jeremy Lewi
  • 6,386
  • 6
  • 22
  • 37
  • Can we package the preprocessing code (feature extraction) along with the trainer code to run as a ml_engine job? – boby aloysius johnson Jul 21 '17 at 06:06
  • To be more specific, if we are using CMLE's rest API, how can I do the preprocessing specified in flower classification specified above? Can I write a python code for preprocessing and package it along with the classifier to make a trainer and run a CMLE job? – boby aloysius johnson Jul 21 '17 at 06:12
  • Can you give some light on how to use tensorflow for poets with CMLE's rest api? Can proper packaging of tensorflow for poets code help to run it with rest api? – boby aloysius johnson Jul 21 '17 at 06:16
  • The blog contains instructions for how to run the preprocessing. Are you running into problems following those instructions? Per the blog post you should download the code and run the preprocessing Dataflow via Python. This will submit a Dataflow job which will produce output on GCS. You can then submit a CMLE job to train a TensorFlow model using the data on GCS. – Jeremy Lewi Jul 21 '17 at 14:05
  • I want a custom image classifier for the images in my PHP website. I have integrated ml_engine rest API to it. I can transfer images from it to GCS. I can create 'train_set.csv', 'eval_set.csv', and 'dict.txt' for those images. I don't want to use Dataflow. I want to do the complete process of training, deployment, and prediction using the rest API. Since it takes only the python package URI for training, is it possible to include 'trainer/preprocess.py' in the package and run preprocessing during the training job? Can I add the scripts to extract features with the package for training? – boby aloysius johnson Jul 21 '17 at 15:19
  • In general, you can't just run a Dataflow pipeline as part of your TensorFlow job because a Dataflow job can do aggregations over all your data; i.e. it isn't just applying a Python function to each record. However, it looks like [preprocess.py](https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/flowers/trainer/preprocess.py) is just a sequence of DoFns. So you could potentially refactor the code to invoke the relevant python functions on each record before feeding them to TensorFlow. – Jeremy Lewi Jul 24 '17 at 00:04