Skip to content

Keras Data Input

Python node : launch with punchplatform-pyspark.sh or the punch UI job-editor with environment pyspark.

This node load the mnist dataset from the keras examples datasets, and publish 1 - 4 streams of type numpy_array : - x_train - y_train - x_test - y_test

The mnist dataset are pictures of handwritten digits in black and white, 28x28 pixels. This node load theses picture in numpy arrays, and normalize the pixels value between 0 an 1 (initial 0 and 255).

This node don't have any configuration parameter.

Example configuration :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
        {
            type: keras_data_input
            component: data_input
            publish: [
                {
                    stream: x_train
                }
                {
                    stream: y_train
                }
                {
                    stream: x_test
                }
                {
                    stream: y_test
                }
            ]
        }

Example of complete pipeline :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  type: pyspark
  runtime_id: simpleJob
  job: [
        {
            type: keras_data_input
            component: data_input
            publish: [
                {
                    stream: x_test
                }
            ]
        }

        {
            type: keras_load_model
            component: model_load
            settings:{
                path: my_model.h5
            }
            publish: [
                {
                    stream: model
                }
            ]
        }

        {
            type: keras_eval_stream
            component: kerissou

            subscribe: [
                {
                    component: data_input
                    stream: x_test
                }

                {
                    component: model_load
                    stream: model
                }
            ]
            publish: [
                {
                    stream: predicts
                }
            ]
        }

        {
            type: show
            component: show,
            subscribe: [
              {
                component: kerissou
                stream: predicts
              }
            ]
        }
  ]
}