(self)
| 14 | save_path = "" |
| 15 | |
| 16 | def Run(self): |
| 17 | |
| 18 | #defining the model... |
| 19 | self.X = tf.placeholder(tf.float32, shape=[None, self._input.input_size], name="x_input") |
| 20 | |
| 21 | _y = self._model.Run(self.X) |
| 22 | |
| 23 | |
| 24 | instance = AIBlocks.InitModel(load_path=self.save_path) |
| 25 | Log("Model initialized!") |
| 26 | |
| 27 | batch = self._input.getTestBatch() |
| 28 | X_batch = batch[0] |
| 29 | Y_batch = batch[1] |
| 30 | |
| 31 | prediction = instance.Run(_y, feed_dict={self.X: X_batch}) |
| 32 | |
| 33 | found=0 |
| 34 | failed=0 |
| 35 | for i in range(len(prediction)): |
| 36 | assert1 = self.max_index(Y_batch[i]) |
| 37 | assert2 = self.max_index(prediction[i]) |
| 38 | |
| 39 | tmp = "Found" |
| 40 | color = "#00ff00" |
| 41 | if assert1!=assert2: |
| 42 | tmp = "Failed" |
| 43 | color = "#ff0000" |
| 44 | failed+=1 |
| 45 | else: |
| 46 | found+=1 |
| 47 | |
| 48 | SendPieData(self.id, tmp, color); |
| 49 | SetState(self.id, i/len(prediction)) |
| 50 | time.sleep(0.1) |
| 51 | |
| 52 | Log("Accuracy: "+str(found/(failed+found)*100)+"%") |
| 53 | |
| 54 | AIBlocks.CloseInstance(instance) |
| 55 | |
| 56 | SetState(self.id, 1) |
| 57 | |
| 58 | def predict(self, input): |
| 59 | return sess.run(_y, feed_dict={self.X: input}) |
nothing calls this directly
no test coverage detected