Turi Create  4.0
data_preparation.hpp
1 /* Copyright © 2019 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_DRAWING_DATA_PREPARATION_H_
7 #define TURI_DRAWING_DATA_PREPARATION_H_
8 
9 #include <core/export.hpp>
10 #include <core/data/sframe/gl_sframe.hpp>
11 #include <model_server/lib/image_util.hpp>
12 
13 namespace turi {
14 namespace drawing_classifier {
15 
16 /**
17  * This function is responsible for converting stroke-based drawing data
18  * to 28x28 bitmaps to make it ready for training with the Neural Network.
19  *
20  *
21  * \param[in] data: SFrame from the user, which contains stroke-based drawings.
22  * Every stroke-based drawing must be represented as
23  * a list of strokes and each stroke must be represented as
24  * a list of points. Each point must be a dictionary with
25  * exactly two keys, "x" and "y".
26  * \param[in] feature: Name of the feature column
27  *
28  *
29  * \return: SFrame with the stroke-based drawings converted to bitmaps, which
30  * are represented as grayscale tc.Image of size 28x28.
31  */
32 EXPORT gl_sframe _drawing_classifier_prepare_data(const gl_sframe &data,
33  const std::string &feature);
34 
35 
36 }
37 }
38 
39 #endif //TURI_DRAWING_DATA_PREPARATION_H_