{"id":1026,"date":"2021-05-08T18:02:15","date_gmt":"2021-05-08T17:02:15","guid":{"rendered":"http:\/\/laserphotonics.uk\/?p=1026"},"modified":"2021-05-08T18:02:17","modified_gmt":"2021-05-08T17:02:17","slug":"machine-learning-for-kids","status":"publish","type":"post","link":"https:\/\/laserphotonics.uk\/?p=1026","title":{"rendered":"machine learning for kids"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\"><strong>from<\/strong> mlforkids <strong>import<\/strong> <strong>MLforKidsImageProject<\/strong>\n\n# treat this key like a password and keep it secret!\nkey = \"bbdf2510-ab32-11eb-b9b5-a98e843d496781e6b159-7cb9-471e-8b4d-b257831c4688\"\n\n# this will train your model and might take a little while\nmyproject = <strong>MLforKidsImageProject<\/strong>(key)\nmyproject.train_model()\n\n# CHANGE THIS to the image file you want to recognize\ndemo = myproject.prediction(\"<strong>my-test-image.jpg<\/strong>\")\n\nlabel = demo[\"class_name\"]\nconfidence = demo[\"confidence\"]\n\n# CHANGE THIS to do something different with the result\n<strong>print<\/strong> (\"result: '%s' with %d%% confidence\" % (label, confidence))<\/pre>\n\n\n\n<p>\n\nTo use this code, you need to:<\/p>\n\n\n\n<ul><li>Use Python 3<\/li><li>Download this&nbsp;<a href=\"https:\/\/raw.githubusercontent.com\/IBM\/taxinomitis\/master\/resources\/mlforkids-requirements.txt\">list of other Python modules you need<\/a><\/li><li>Install the other Python modules by running<br><code>pip install -r mlforkids-requirements.txt<\/code><\/li><li>Download&nbsp;<a href=\"https:\/\/raw.githubusercontent.com\/IBM\/taxinomitis\/master\/resources\/mlforkids.py\">mlforkids.py<\/a>&nbsp;to the folder where you will run your Python code<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>from mlforkids import MLforKidsImageProject # treat this key like a password and keep it secret! key = &#8220;bbdf2510-ab32-11eb-b9b5-a98e843d496781e6b159-7cb9-471e-8b4d-b257831c4688&#8221; # this will train your model and might take a little while myproject = MLforKidsImageProject(key) myproject.train_model() # CHANGE THIS to the image file you want to recognize demo = myproject.prediction(&#8220;my-test-image.jpg&#8221;) label = demo[&#8220;class_name&#8221;] confidence = demo[&#8220;confidence&#8221;] # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/1026"}],"collection":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1026"}],"version-history":[{"count":1,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/1026\/revisions"}],"predecessor-version":[{"id":1027,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=\/wp\/v2\/posts\/1026\/revisions\/1027"}],"wp:attachment":[{"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laserphotonics.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}