Skip to main content
edited tags
Link
xslittlegrass
  • 27.8k
  • 9
  • 102
  • 187
edited title
Source Link

I wrote the following code to make an interactive GUI for Mathematica's Neural Network example of

Digit Classification

Here is the Code

DynamicModule[{l = {}},
 {EventHandler[
   Dynamic[s = 
     Graphics[{EdgeForm[Thick], White, Rectangle[{0, 0}, {2, 2}], 
       PointSize[.04], Black, 
       Point[l]}, {PlotRange -> {{0, 2}, {0, 
          2}}}]], {"MouseDragged" :> (l = 
       Append[l, MousePosition["Graphics"]])}]}]

and Then I feed $s$ into the Neural Network Dynamically

Dynamic[Thread[Image[s] -> lenet[Image[s]]]]

This works. But makes the whole thing slow if I am drawing.(I have an Amd Fx-4350 and 16 gigs of RAM). You may have also noticed that I am plotting points, which may not be the best choice for drawing. If you want to improve my code from any direction, you are welcome to do that

I wrote the following code to make an interactive GUI for Mathematica's Neural Network example of

Digit Classification

Here is the Code

DynamicModule[{l = {}},
 {EventHandler[
   Dynamic[s = 
     Graphics[{EdgeForm[Thick], White, Rectangle[{0, 0}, {2, 2}], 
       PointSize[.04], Black, 
       Point[l]}, {PlotRange -> {{0, 2}, {0, 
          2}}}]], {"MouseDragged" :> (l = 
       Append[l, MousePosition["Graphics"]])}]}]

and Then I feed $s$ into the Neural Network Dynamically

Dynamic[Thread[Image[s] -> lenet[Image[s]]]]

This works. But makes the whole thing slow.(I have an Amd Fx-4350 and 16 gigs of RAM). You may have also noticed that I am plotting points, which may not be the best choice for drawing. If you want to improve my code from any direction, you are welcome to do that

I wrote the following code to make an interactive GUI for Mathematica's Neural Network example of

Digit Classification

Here is the Code

DynamicModule[{l = {}},
 {EventHandler[
   Dynamic[s = 
     Graphics[{EdgeForm[Thick], White, Rectangle[{0, 0}, {2, 2}], 
       PointSize[.04], Black, 
       Point[l]}, {PlotRange -> {{0, 2}, {0, 
          2}}}]], {"MouseDragged" :> (l = 
       Append[l, MousePosition["Graphics"]])}]}]

and Then I feed $s$ into the Neural Network Dynamically

Dynamic[Thread[Image[s] -> lenet[Image[s]]]]

This works. But makes the whole thing slow if I am drawing.(I have an Amd Fx-4350 and 16 gigs of RAM). You may have also noticed that I am plotting points, which may not be the best choice for drawing. If you want to improve my code from any direction, you are welcome to do that

edited title
Link

Response of Dynamic is Slowslow

Source Link
Loading