-
Notifications
You must be signed in to change notification settings - Fork 0
/
mxnet.json
1 lines (1 loc) · 12.3 KB
/
mxnet.json
1
{"paragraphs":[{"text":"%pyspark \n\nprint hi","user":"admin","dateUpdated":"2018-02-23T15:16:34+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python","editOnDblClick":false},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"results":{"code":"ERROR","msg":[{"type":"TEXT","data":"java.lang.NullPointerException\n\tat org.apache.zeppelin.spark.Utils.invokeMethod(Utils.java:38)\n\tat org.apache.zeppelin.spark.Utils.invokeMethod(Utils.java:33)\n\tat org.apache.zeppelin.spark.SparkInterpreter.createSparkContext_2(SparkInterpreter.java:392)\n\tat org.apache.zeppelin.spark.SparkInterpreter.createSparkContext(SparkInterpreter.java:381)\n\tat org.apache.zeppelin.spark.SparkInterpreter.getSparkContext(SparkInterpreter.java:146)\n\tat org.apache.zeppelin.spark.SparkInterpreter.open(SparkInterpreter.java:834)\n\tat org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.getSparkInterpreter(PySparkInterpreter.java:567)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.createGatewayServerAndStartScript(PySparkInterpreter.java:210)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.open(PySparkInterpreter.java:163)\n\tat org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\n\tat org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:493)\n\tat org.apache.zeppelin.scheduler.Job.run(Job.java:175)\n\tat org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat java.lang.Thread.run(Thread.java:745)\n"}]},"apps":[],"jobName":"paragraph_1519338507684_1093824126","id":"20180222-222827_2061696077","dateCreated":"2018-02-22T22:28:27+0000","dateStarted":"2018-02-23T15:16:35+0000","dateFinished":"2018-02-23T15:17:08+0000","status":"ERROR","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:1297"},{"text":"%pyspark\n\nimport time\nimport sys\nimport datetime\nimport subprocess\nimport sys\nimport os\nimport datetime\nimport traceback\nimport math\nimport random, string\nimport base64\nimport json\nfrom time import gmtime, strftime\nimport mxnet as mx\nimport inception_predict\nimport numpy as np\nimport math\nimport random, string\nimport time\n\nfrom time import gmtime, strftime\nstart = time.time()\n\nprint \"Test\"","user":"admin","dateUpdated":"2018-02-22T22:33:14+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python"},"settings":{"params":{},"forms":{}},"results":{"code":"ERROR","msg":[{"type":"TEXT","data":"java.lang.NullPointerException\n\tat org.apache.zeppelin.spark.Utils.invokeMethod(Utils.java:38)\n\tat org.apache.zeppelin.spark.Utils.invokeMethod(Utils.java:33)\n\tat org.apache.zeppelin.spark.SparkInterpreter.createSparkContext_2(SparkInterpreter.java:392)\n\tat org.apache.zeppelin.spark.SparkInterpreter.createSparkContext(SparkInterpreter.java:381)\n\tat org.apache.zeppelin.spark.SparkInterpreter.getSparkContext(SparkInterpreter.java:146)\n\tat org.apache.zeppelin.spark.SparkInterpreter.open(SparkInterpreter.java:834)\n\tat org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.getSparkInterpreter(PySparkInterpreter.java:567)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.createGatewayServerAndStartScript(PySparkInterpreter.java:210)\n\tat org.apache.zeppelin.spark.PySparkInterpreter.open(PySparkInterpreter.java:163)\n\tat org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69)\n\tat org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:493)\n\tat org.apache.zeppelin.scheduler.Job.run(Job.java:175)\n\tat org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat java.lang.Thread.run(Thread.java:745)\n"}]},"apps":[],"jobName":"paragraph_1519338715377_-1724401915","id":"20180222-223155_644117546","dateCreated":"2018-02-22T22:31:55+0000","dateStarted":"2018-02-22T22:33:14+0000","dateFinished":"2018-02-22T22:33:30+0000","status":"ERROR","progressUpdateIntervalMs":500,"$$hashKey":"object:1298"},{"text":"%pyspark\n\nimport sys\nfrom pyspark.context import SparkContext\nimport datetime\nimport subprocess\nimport sys\nimport os\nimport datetime\nimport traceback\nimport math\nimport random, string\nimport base64\nimport json\nfrom time import gmtime, strftime\nimport mxnet as mx\nimport numpy as np\nimport math\nimport random, string\nimport time\n\nfrom time import gmtime, strftime\nstart = time.time()\n\nprint \"Test\"\n\n\n","user":"admin","dateUpdated":"2018-03-02T16:14:18+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"python"},"editorMode":"ace/mode/python","editorHide":true,"tableHide":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1519338794256_1308728550","id":"20180222-223314_155212222","dateCreated":"2018-02-22T22:33:14+0000","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:1299","dateFinished":"2018-03-02T15:53:05+0000","dateStarted":"2018-03-02T15:53:03+0000","results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"Test\n"}]}},{"text":"%pyspark\n\n\n\nimport time\nimport sys\nimport datetime\nimport subprocess\nimport sys\nimport os\nimport datetime\nimport traceback\nimport math\nimport random, string\nimport base64\nimport json\nfrom time import gmtime, strftime\nimport mxnet as mx\nimport numpy as np\nimport math\nimport random, string\nimport time\nfrom time import gmtime, strftime\n# forked from Apache MXNet example with minor changes for osx\nimport time\nimport mxnet as mx\nimport numpy as np\nimport cv2, os, urllib\nfrom collections import namedtuple\nBatch = namedtuple('Batch', ['data'])\n \n \n# Load the symbols for the networks\nwith open('/opt/demo/incubator-mxnet/synset.txt', 'r') as f:\n synsets = [l.rstrip() for l in f]\n \n \n# Load the network parameters\nsym, arg_params, aux_params = mx.model.load_checkpoint('/opt/demo/incubator-mxnet/Inception-BN', 0)\n \n \n# Load the network into an MXNet module and bind the corresponding parameters\nmod = mx.mod.Module(symbol=sym, context=mx.cpu())\nmod.bind(for_training=False, data_shapes=[('data', (1,3,224,224))])\nmod.set_params(arg_params, aux_params)\n \n \n'''\nFunction to predict objects by giving the model a pointer to an image file and running a forward pass through the model.\n \n \ninputs:\nfilename = jpeg file of image to classify objects in\nmod = the module object representing the loaded model\nsynsets = the list of symbols representing the model\nN = Optional parameter denoting how many predictions to return (default is top 5)\n \n \noutputs:\npython list of top N predicted objects and corresponding probabilities\n'''\ndef predict(filename, mod, synsets, N=5):\n tic = time.time()\n img = cv2.cvtColor(cv2.imread(filename), cv2.COLOR_BGR2RGB)\n if img is None:\n return None\n img = cv2.resize(img, (224, 224))\n img = np.swapaxes(img, 0, 2)\n img = np.swapaxes(img, 1, 2)\n img = img[np.newaxis, :]\n \n \n toc = time.time()\n mod.forward(Batch([mx.nd.array(img)]))\n prob = mod.get_outputs()[0].asnumpy()\n prob = np.squeeze(prob)\n \n \n topN = []\n a = np.argsort(prob)[::-1]\n for i in a[0:N]:\n topN.append((prob[i], synsets[i]))\n return topN\n \n \n \n \n# Code to download an image from the internet and run a prediction on it\ndef predict_from_url(url, N=5):\n filename = url.split(\"/\")[-1]\n urllib.urlretrieve(url, filename)\n img = cv2.imread(filename)\n if img is None:\n print( \"Failed to download\" )\n else:\n return predict(filename, mod, synsets, N)\n \n \n# Code to predict on a local file\ndef predict_from_local_file(filename, N=5):\n return predict(filename, mod, synsets, N)\n \n \nstart = time.time()\n \n \npacket_size=3000\n \n \n \n \n# Create unique image name\nuniqueid = 'mxnet_uuid_{0}_{1}.json'.format('json',strftime(\"%Y%m%d%H%M%S\",gmtime()))\n \n \nfilename = '/opt/demo/incubator-mxnet/nanotie7.png'\ntopn = []\n# Run inception prediction on image\ntry:\n topn = predict_from_local_file(filename, N=5)\nexcept:\n print(\"Error\")\n errorcondition = \"true\"\n \n \ntry:\n # 5 MXNET Analysis\n top1 = str(topn[0][1])\n top1pct = str(round(topn[0][0],3) * 100)\n \n \n top2 = str(topn[1][1])\n top2pct = str(round(topn[1][0],3) * 100)\n \n \n top3 = str(topn[2][1])\n top3pct = str(round(topn[2][0],3) * 100)\n \n \n top4 = str(topn[3][1])\n top4pct = str(round(topn[3][0],3) * 100)\n \n \n top5 = str(topn[4][1])\n top5pct = str(round(topn[4][0],3) * 100)\n \n \n end = time.time()\n \n \n row = { 'uuid': uniqueid, 'top1pct': top1pct, 'top1': top1, 'top2pct': top2pct, 'top2': top2,'top3pct': top3pct, 'top3': top3,'top4pct': top4pct,'top4': top4, 'top5pct': top5pct,'top5': top5, 'imagefilename': filename, 'runtime': str(round(end - start)) }\n json_string = json.dumps(row)\n \n \n print (json_string)\n\n \nexcept:\n print(\"{\\\"message\\\": \\\"Failed to run\\\"}\")","user":"admin","dateUpdated":"2018-03-02T16:12:23+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"scala"},"editorMode":"ace/mode/scala"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1520005851329_-285694118","id":"20180302-155051_242617183","dateCreated":"2018-03-02T15:50:51+0000","status":"FINISHED","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:1505","dateFinished":"2018-03-02T16:12:34+0000","dateStarted":"2018-03-02T16:12:23+0000","results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"[16:12:23] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...\n[16:12:23] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!\n/usr/lib/python2.7/site-packages/mxnet/module/base_module.py:65: UserWarning: Data provided by label_shapes don't match names specified by label_names ([] vs. ['softmax_label'])\n warnings.warn(msg)\n{\"top1pct\": \"67.6\", \"top5\": \"n03485794 handkerchief, hankie, hanky, hankey\", \"top4\": \"n04590129 window shade\", \"top3\": \"n03938244 pillow\", \"top2\": \"n04589890 window screen\", \"top1\": \"n02883205 bow tie, bow-tie, bowtie\", \"top2pct\": \"11.5\", \"imagefilename\": \"/opt/demo/incubator-mxnet/nanotie7.png\", \"top3pct\": \"4.5\", \"uuid\": \"mxnet_uuid_json_20180302161224.json\", \"top4pct\": \"2.8\", \"top5pct\": \"2.8\", \"runtime\": \"10.0\"}\n"}]}},{"text":"%pyspark\n","user":"admin","dateUpdated":"2018-03-02T16:12:23+0000","config":{"colWidth":12,"enabled":true,"results":{},"editorSetting":{"language":"scala"},"editorMode":"ace/mode/scala"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1520007143744_-1380253833","id":"20180302-161223_1480321954","dateCreated":"2018-03-02T16:12:23+0000","status":"READY","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:1622"}],"name":"mxnet","id":"2D8KQQ4YW","angularObjects":{"2CHS8UYQQ:shared_process":[],"2C8A4SZ9T_livy2:shared_process":[],"2CK8A9MEG:shared_process":[],"2C4U48MY3_spark2:shared_process":[],"2CKAY1A8Y:shared_process":[],"2CKEKWY8Z:shared_process":[]},"config":{"looknfeel":"default","personalizedMode":"false"},"info":{}}