keypadml 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {keypadml-0.3.1 → keypadml-0.3.2}/CHANGELOG.md +5 -0
  2. {keypadml-0.3.1 → keypadml-0.3.2}/CITATION.cff +1 -1
  3. {keypadml-0.3.1/src/keypadml.egg-info → keypadml-0.3.2}/PKG-INFO +10 -6
  4. {keypadml-0.3.1 → keypadml-0.3.2}/README.md +9 -5
  5. keypadml-0.3.2/src/keypadml/_version.py +1 -0
  6. {keypadml-0.3.1 → keypadml-0.3.2/src/keypadml.egg-info}/PKG-INFO +10 -6
  7. keypadml-0.3.1/src/keypadml/_version.py +0 -1
  8. {keypadml-0.3.1 → keypadml-0.3.2}/LICENSE +0 -0
  9. {keypadml-0.3.1 → keypadml-0.3.2}/MANIFEST.in +0 -0
  10. {keypadml-0.3.1 → keypadml-0.3.2}/docs/benchmark-plan.md +0 -0
  11. {keypadml-0.3.1 → keypadml-0.3.2}/docs/benchmark-results.md +0 -0
  12. {keypadml-0.3.1 → keypadml-0.3.2}/docs/guide.md +0 -0
  13. {keypadml-0.3.1 → keypadml-0.3.2}/docs/logo.png +0 -0
  14. {keypadml-0.3.1 → keypadml-0.3.2}/docs/results-format.md +0 -0
  15. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/nokia6210_pets.png +0 -0
  16. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/nokia6600i_cifar10.png +0 -0
  17. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/nokiac7_mnist.png +0 -0
  18. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/nokiae72_fmnist.png +0 -0
  19. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/results-page-cifar10.png +0 -0
  20. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/results-page.png +0 -0
  21. {keypadml-0.3.1 → keypadml-0.3.2}/docs/screenshots/sonyericssonc902_pets.png +0 -0
  22. {keypadml-0.3.1 → keypadml-0.3.2}/docs/try-it.md +0 -0
  23. {keypadml-0.3.1 → keypadml-0.3.2}/examples/big_input.py +0 -0
  24. {keypadml-0.3.1 → keypadml-0.3.2}/examples/cifar10_cnn.py +0 -0
  25. {keypadml-0.3.1 → keypadml-0.3.2}/examples/mnist_lenet.py +0 -0
  26. {keypadml-0.3.1 → keypadml-0.3.2}/java/desktop/kp/desktop/DesktopRun.java +0 -0
  27. {keypadml-0.3.1 → keypadml-0.3.2}/java/desktop/kp/desktop/PhotoRun.java +0 -0
  28. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Bench.java +0 -0
  29. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/BenchMIDlet.java +0 -0
  30. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Camera.java +0 -0
  31. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Card.java +0 -0
  32. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Inputs.java +0 -0
  33. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Jpeg.java +0 -0
  34. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/MathX.java +0 -0
  35. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Net.java +0 -0
  36. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Ops.java +0 -0
  37. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Parts.java +0 -0
  38. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Photo.java +0 -0
  39. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/ResultsCanvas.java +0 -0
  40. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/Saver.java +0 -0
  41. {keypadml-0.3.1 → keypadml-0.3.2}/java/phone/kp/TryIt.java +0 -0
  42. {keypadml-0.3.1 → keypadml-0.3.2}/pyproject.toml +0 -0
  43. {keypadml-0.3.1 → keypadml-0.3.2}/scripts/build_runtime.py +0 -0
  44. {keypadml-0.3.1 → keypadml-0.3.2}/scripts/make_icon.py +0 -0
  45. {keypadml-0.3.1 → keypadml-0.3.2}/setup.cfg +0 -0
  46. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/__init__.py +0 -0
  47. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/desktop/kp/desktop/DesktopRun$1.class +0 -0
  48. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/desktop/kp/desktop/DesktopRun.class +0 -0
  49. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/desktop/kp/desktop/PhotoRun$1.class +0 -0
  50. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/desktop/kp/desktop/PhotoRun.class +0 -0
  51. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/icon.png +0 -0
  52. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Bench$Listener.class +0 -0
  53. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Bench.class +0 -0
  54. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/BenchMIDlet$1.class +0 -0
  55. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/BenchMIDlet$2.class +0 -0
  56. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/BenchMIDlet$3.class +0 -0
  57. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/BenchMIDlet.class +0 -0
  58. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Camera.class +0 -0
  59. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Card$1.class +0 -0
  60. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Card.class +0 -0
  61. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Inputs.class +0 -0
  62. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Jpeg$Huffman.class +0 -0
  63. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Jpeg.class +0 -0
  64. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/MathX.class +0 -0
  65. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Net.class +0 -0
  66. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Ops.class +0 -0
  67. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Parts.class +0 -0
  68. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Photo$Rows.class +0 -0
  69. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Photo.class +0 -0
  70. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/ResultsCanvas.class +0 -0
  71. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/Saver.class +0 -0
  72. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$1.class +0 -0
  73. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$2.class +0 -0
  74. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$3.class +0 -0
  75. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$4.class +0 -0
  76. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$5.class +0 -0
  77. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$6.class +0 -0
  78. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$7.class +0 -0
  79. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$8.class +0 -0
  80. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$Files.class +0 -0
  81. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$Job.class +0 -0
  82. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt$Snapper.class +0 -0
  83. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_runtime/phone/kp/TryIt.class +0 -0
  84. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/_tools.py +0 -0
  85. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/cli.py +0 -0
  86. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/convert.py +0 -0
  87. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/export.py +0 -0
  88. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/graph.py +0 -0
  89. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/jarfile.py +0 -0
  90. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/photo.py +0 -0
  91. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/py.typed +0 -0
  92. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/reference.py +0 -0
  93. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/report.py +0 -0
  94. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/runner.py +0 -0
  95. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml/serialize.py +0 -0
  96. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml.egg-info/SOURCES.txt +0 -0
  97. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml.egg-info/dependency_links.txt +0 -0
  98. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml.egg-info/entry_points.txt +0 -0
  99. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml.egg-info/requires.txt +0 -0
  100. {keypadml-0.3.1 → keypadml-0.3.2}/src/keypadml.egg-info/top_level.txt +0 -0
  101. {keypadml-0.3.1 → keypadml-0.3.2}/tests/__init__.py +0 -0
  102. {keypadml-0.3.1 → keypadml-0.3.2}/tests/conftest.py +0 -0
  103. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_big256_parts.json +0 -0
  104. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_big256_v0.3.json +0 -0
  105. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_big288_parts.json +0 -0
  106. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_cifar10_v0.3.json +0 -0
  107. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_lenet_v0.1.txt +0 -0
  108. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_lenet_v0.2.txt +0 -0
  109. {keypadml-0.3.1 → keypadml-0.3.2}/tests/data/nokia6600i_lenet_v0.3.json +0 -0
  110. {keypadml-0.3.1 → keypadml-0.3.2}/tests/test_models.py +0 -0
  111. {keypadml-0.3.1 → keypadml-0.3.2}/tests/test_photo.py +0 -0
  112. {keypadml-0.3.1 → keypadml-0.3.2}/tests/test_unit.py +0 -0
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2 (2026-12-03)
4
+
5
+ * README: the quick-start example now makes a jar with Try it (camera and photos), trained on
6
+ dark-on-white digits so that a photo of a digit written on paper is read. No change to the library.
7
+
3
8
  ## 0.3.1 (2026-12-03)
4
9
 
5
10
  * README: a complete quick-start example (MNIST, a small CNN, one epoch of training, export and
@@ -5,4 +5,4 @@ type: software
5
5
  authors:
6
6
  - name: "Said Ohamouddou"
7
7
  license: Apache-2.0
8
- version: 0.3.1
8
+ version: 0.3.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keypadml
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Run and benchmark PyTorch CNNs on old Java ME feature phones: export to a .jar, run it on the phone, check it against PyTorch.
5
5
  Author: Said Ohamouddou
6
6
  License-Expression: Apache-2.0
@@ -79,9 +79,10 @@ import torch.nn.functional as F
79
79
  from torchvision import datasets, transforms
80
80
  import keypadml
81
81
 
82
- # 1. Dataset: MNIST handwritten digits (downloaded on first run)
83
- train = datasets.MNIST("data", train=True, download=True, transform=transforms.ToTensor())
84
- test = datasets.MNIST("data", train=False, download=True, transform=transforms.ToTensor())
82
+ # 1. Dataset: MNIST digits, inverted to dark ink on white, like a photo of a digit on paper
83
+ tf = transforms.Compose([transforms.ToTensor(), lambda t: 1 - t])
84
+ train = datasets.MNIST("data", train=True, download=True, transform=tf)
85
+ test = datasets.MNIST("data", train=False, download=True, transform=tf)
85
86
 
86
87
  # 2. A small CNN: two conv blocks and a classifier
87
88
  model = nn.Sequential(
@@ -100,13 +101,16 @@ for x, y in torch.utils.data.DataLoader(train, batch_size=64, shuffle=True):
100
101
  # 4. Export the model with 20 test digits to bench/MNIST.jar
101
102
  inputs, labels = keypadml.sample(test, n=20)
102
103
  result = keypadml.export(model.eval(), inputs, labels, out_dir="bench", name="MNIST",
103
- class_names=[str(d) for d in range(10)])
104
+ class_names=[str(d) for d in range(10)],
105
+ photo=dict(mean=[0.0], std=[1.0])) # Try it: camera and photos
104
106
  print(result) # jar size, parameters, multiply-adds, memory estimate
105
107
  keypadml.verify(result) # optional (needs Java): run the phone's code on this PC
106
108
  ```
107
109
 
108
110
  **Run it on the phone.** Copy `bench/MNIST.jar` to the phone, open it and press **Start**. The
109
- results are saved on the memory card in `keypadml/<phone model>/`.
111
+ results are saved on the memory card in `keypadml/<phone model>/`. Then choose **Try it: camera** and
112
+ photograph a digit written large with a dark pen on white paper, filling the middle of the picture:
113
+ the phone shows the digit it reads.
110
114
 
111
115
  **Read the report** on your computer. Here is a real Nokia 6600i run of a LeNet (shortened):
112
116
 
@@ -51,9 +51,10 @@ import torch.nn.functional as F
51
51
  from torchvision import datasets, transforms
52
52
  import keypadml
53
53
 
54
- # 1. Dataset: MNIST handwritten digits (downloaded on first run)
55
- train = datasets.MNIST("data", train=True, download=True, transform=transforms.ToTensor())
56
- test = datasets.MNIST("data", train=False, download=True, transform=transforms.ToTensor())
54
+ # 1. Dataset: MNIST digits, inverted to dark ink on white, like a photo of a digit on paper
55
+ tf = transforms.Compose([transforms.ToTensor(), lambda t: 1 - t])
56
+ train = datasets.MNIST("data", train=True, download=True, transform=tf)
57
+ test = datasets.MNIST("data", train=False, download=True, transform=tf)
57
58
 
58
59
  # 2. A small CNN: two conv blocks and a classifier
59
60
  model = nn.Sequential(
@@ -72,13 +73,16 @@ for x, y in torch.utils.data.DataLoader(train, batch_size=64, shuffle=True):
72
73
  # 4. Export the model with 20 test digits to bench/MNIST.jar
73
74
  inputs, labels = keypadml.sample(test, n=20)
74
75
  result = keypadml.export(model.eval(), inputs, labels, out_dir="bench", name="MNIST",
75
- class_names=[str(d) for d in range(10)])
76
+ class_names=[str(d) for d in range(10)],
77
+ photo=dict(mean=[0.0], std=[1.0])) # Try it: camera and photos
76
78
  print(result) # jar size, parameters, multiply-adds, memory estimate
77
79
  keypadml.verify(result) # optional (needs Java): run the phone's code on this PC
78
80
  ```
79
81
 
80
82
  **Run it on the phone.** Copy `bench/MNIST.jar` to the phone, open it and press **Start**. The
81
- results are saved on the memory card in `keypadml/<phone model>/`.
83
+ results are saved on the memory card in `keypadml/<phone model>/`. Then choose **Try it: camera** and
84
+ photograph a digit written large with a dark pen on white paper, filling the middle of the picture:
85
+ the phone shows the digit it reads.
82
86
 
83
87
  **Read the report** on your computer. Here is a real Nokia 6600i run of a LeNet (shortened):
84
88
 
@@ -0,0 +1 @@
1
+ __version__ = "0.3.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keypadml
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Run and benchmark PyTorch CNNs on old Java ME feature phones: export to a .jar, run it on the phone, check it against PyTorch.
5
5
  Author: Said Ohamouddou
6
6
  License-Expression: Apache-2.0
@@ -79,9 +79,10 @@ import torch.nn.functional as F
79
79
  from torchvision import datasets, transforms
80
80
  import keypadml
81
81
 
82
- # 1. Dataset: MNIST handwritten digits (downloaded on first run)
83
- train = datasets.MNIST("data", train=True, download=True, transform=transforms.ToTensor())
84
- test = datasets.MNIST("data", train=False, download=True, transform=transforms.ToTensor())
82
+ # 1. Dataset: MNIST digits, inverted to dark ink on white, like a photo of a digit on paper
83
+ tf = transforms.Compose([transforms.ToTensor(), lambda t: 1 - t])
84
+ train = datasets.MNIST("data", train=True, download=True, transform=tf)
85
+ test = datasets.MNIST("data", train=False, download=True, transform=tf)
85
86
 
86
87
  # 2. A small CNN: two conv blocks and a classifier
87
88
  model = nn.Sequential(
@@ -100,13 +101,16 @@ for x, y in torch.utils.data.DataLoader(train, batch_size=64, shuffle=True):
100
101
  # 4. Export the model with 20 test digits to bench/MNIST.jar
101
102
  inputs, labels = keypadml.sample(test, n=20)
102
103
  result = keypadml.export(model.eval(), inputs, labels, out_dir="bench", name="MNIST",
103
- class_names=[str(d) for d in range(10)])
104
+ class_names=[str(d) for d in range(10)],
105
+ photo=dict(mean=[0.0], std=[1.0])) # Try it: camera and photos
104
106
  print(result) # jar size, parameters, multiply-adds, memory estimate
105
107
  keypadml.verify(result) # optional (needs Java): run the phone's code on this PC
106
108
  ```
107
109
 
108
110
  **Run it on the phone.** Copy `bench/MNIST.jar` to the phone, open it and press **Start**. The
109
- results are saved on the memory card in `keypadml/<phone model>/`.
111
+ results are saved on the memory card in `keypadml/<phone model>/`. Then choose **Try it: camera** and
112
+ photograph a digit written large with a dark pen on white paper, filling the middle of the picture:
113
+ the phone shows the digit it reads.
110
114
 
111
115
  **Read the report** on your computer. Here is a real Nokia 6600i run of a LeNet (shortened):
112
116
 
@@ -1 +0,0 @@
1
- __version__ = "0.3.1"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes