blocklearning 0.1.0__py3-none-any.whl

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 (74) hide show
  1. blocklearning/__init__.py +1 -0
  2. blocklearning/__main__.py +6 -0
  3. blocklearning/analysis.py +133 -0
  4. blocklearning/anomaly.py +148 -0
  5. blocklearning/blocks.py +601 -0
  6. blocklearning/cli.py +46 -0
  7. blocklearning/codegen.py +1012 -0
  8. blocklearning/core.py +861 -0
  9. blocklearning/data/bearing_uottawa.SOURCE.txt +6 -0
  10. blocklearning/data/bearing_uottawa.npz +0 -0
  11. blocklearning/data/concrete.SOURCE.txt +4 -0
  12. blocklearning/data/concrete.npz +0 -0
  13. blocklearning/data/digits32.SOURCE.txt +4 -0
  14. blocklearning/data/digits32.npz +0 -0
  15. blocklearning/data/ecg_mitdb.SOURCE.txt +6 -0
  16. blocklearning/data/ecg_mitdb.npz +0 -0
  17. blocklearning/data/hydraulic.SOURCE.txt +6 -0
  18. blocklearning/data/hydraulic.npz +0 -0
  19. blocklearning/data/pcb_det.SOURCE.txt +6 -0
  20. blocklearning/data/pcb_det.npz +0 -0
  21. blocklearning/data/pneumatic_seg.SOURCE.txt +8 -0
  22. blocklearning/data/pneumatic_seg.npz +0 -0
  23. blocklearning/data/pneumonia28.SOURCE.txt +13 -0
  24. blocklearning/data/pneumonia28.npz +0 -0
  25. blocklearning/data/steel_plates.SOURCE.txt +5 -0
  26. blocklearning/data/steel_plates.npz +0 -0
  27. blocklearning/data/steel_power.SOURCE.txt +3 -0
  28. blocklearning/data/steel_power.npz +0 -0
  29. blocklearning/data/steelblast.SOURCE.txt +4 -0
  30. blocklearning/data/steelblast.npz +0 -0
  31. blocklearning/data.py +1158 -0
  32. blocklearning/detect.py +222 -0
  33. blocklearning/forecast.py +204 -0
  34. blocklearning/graph.py +602 -0
  35. blocklearning/jobs.py +501 -0
  36. blocklearning/labeling.py +1294 -0
  37. blocklearning/labeling_sources.py +217 -0
  38. blocklearning/layers.py +615 -0
  39. blocklearning/losses.py +199 -0
  40. blocklearning/multi.py +175 -0
  41. blocklearning/nn_extra.py +643 -0
  42. blocklearning/predict.py +344 -0
  43. blocklearning/pretrained/LICENSE-mnv3s.txt +202 -0
  44. blocklearning/pretrained/mnv3s.SOURCE.txt +6 -0
  45. blocklearning/pretrained/mnv3s.bin +0 -0
  46. blocklearning/pretrained/mnv3s.json +1 -0
  47. blocklearning/pretrained.py +56 -0
  48. blocklearning/project.py +120 -0
  49. blocklearning/segment.py +173 -0
  50. blocklearning/server.py +116 -0
  51. blocklearning/static/app.js +1986 -0
  52. blocklearning/static/boot.js +51 -0
  53. blocklearning/static/demo.jpg +0 -0
  54. blocklearning/static/demo.webm +0 -0
  55. blocklearning/static/engine.js +1326 -0
  56. blocklearning/static/graph.js +1902 -0
  57. blocklearning/static/index.html +301 -0
  58. blocklearning/static/label.html +158 -0
  59. blocklearning/static/label.js +1040 -0
  60. blocklearning/static/labels.js +227 -0
  61. blocklearning/static/projects.js +516 -0
  62. blocklearning/static/store.js +259 -0
  63. blocklearning/static/style.css +844 -0
  64. blocklearning/static/train-worker.js +41 -0
  65. blocklearning/static/web.js +602 -0
  66. blocklearning/tasks.py +351 -0
  67. blocklearning/web.py +412 -0
  68. blocklearning/weblabel.py +316 -0
  69. blocklearning-0.1.0.dist-info/METADATA +66 -0
  70. blocklearning-0.1.0.dist-info/RECORD +74 -0
  71. blocklearning-0.1.0.dist-info/WHEEL +4 -0
  72. blocklearning-0.1.0.dist-info/entry_points.txt +2 -0
  73. blocklearning-0.1.0.dist-info/licenses/LICENSE +25 -0
  74. blocklearning-0.1.0.dist-info/licenses/src/blocklearning/pretrained/LICENSE-mnv3s.txt +202 -0
@@ -0,0 +1,316 @@
1
+ """웹 버전의 라벨링 작업: 브라우저 보관함(IndexedDB)에 '작업'(정답 JSON)과 '데이터 사본'(zip)으로 두고,
2
+ 열 때 Pyodide 파일 시스템에 다시 풀어 LabelProject로 연다. 라벨링 페이지와 studio(② 라벨링한 데이터)가 함께 쓴다.
3
+
4
+ 파일 자리: 고른 데이터는 /data/u<번호>/... (web.js의 writeFiles), 다시 푼 작업은 /data/L<번호>/...
5
+ 작업 파일은 그 뿌리 바로 아래 _work.dllabel (데이터 폴더 밖이라 데이터로 읽히지 않음).
6
+ 작업 JSON의 데이터 경로는 옮길 수 있게 "@data/<뿌리>/..."로 적어 둔다.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import io
11
+ import json
12
+ import os
13
+ import re
14
+ import zipfile
15
+
16
+ import numpy as np
17
+
18
+ from blocklearning.core import Studio, UserError, _clean
19
+ from blocklearning import web
20
+ from blocklearning.web import _wrap
21
+
22
+ WORK = "_work.dllabel"
23
+ OUT = "/out" # 내려받을 파일을 잠시 두는 곳 (시험은 바꿔 씀)
24
+ _MARK = "@data/"
25
+ _n = [0]
26
+
27
+
28
+ def _root(path: str) -> str:
29
+ m = re.match(re.escape(web.DATA_DIR) + r"/([uL]\d+)(/|$)", str(path or ""))
30
+ if not m:
31
+ raise UserError("데이터 자리를 알 수 없음", "데이터를 다시 고르세요")
32
+ return m.group(1)
33
+
34
+
35
+ def _new_root() -> str:
36
+ while True:
37
+ _n[0] += 1
38
+ r = f"L{_n[0]}"
39
+ if not os.path.exists(f"{web.DATA_DIR}/{r}"):
40
+ return r
41
+
42
+
43
+ @_wrap
44
+ def new_job(studio: Studio, body_json: str) -> dict:
45
+ """새 라벨링 작업: 고른 데이터(/data/u<번호>/...) 옆에 작업 파일을 두고 만듦."""
46
+ b = json.loads(body_json)
47
+ root = _root(b.get("path"))
48
+ b["file"] = f"{web.DATA_DIR}/{root}/{WORK}"
49
+ code, r = studio.call("POST", "/api/label/new", b)
50
+ if code != 200:
51
+ e = r["error"]
52
+ raise UserError(e["message"], e.get("hint", ""), e.get("issues"))
53
+ return r
54
+
55
+
56
+ def work_text(studio: Studio) -> str:
57
+ """지금 작업의 정답 JSON (데이터 경로는 @data/...로)."""
58
+ p = studio.label
59
+ if p is None:
60
+ raise UserError("라벨링 작업이 없음", "작업을 새로 만들거나 여세요")
61
+ return json.dumps(_portable(p.meta, p.file), ensure_ascii=False)
62
+
63
+
64
+ def data_bytes(studio: Studio) -> bytes:
65
+ """지금 작업의 데이터 사본 (뿌리 아래 파일 전부, 작업 파일·내보낸 파일 빼고) → zip 바이트. 데이터를 바꾸지 않으니 처음 한 번만."""
66
+ p = studio.label
67
+ root = _root(p.file)
68
+ base = f"{web.DATA_DIR}/{root}"
69
+ src = os.path.normpath(p.meta["source"]["path"])
70
+ buf = io.BytesIO()
71
+ with zipfile.ZipFile(buf, "w", compression=zipfile.ZIP_STORED) as z:
72
+ for dirpath, _, files in os.walk(base):
73
+ for f in files:
74
+ full = os.path.normpath(os.path.join(dirpath, f))
75
+ if full == src or full.startswith(src + os.sep): # 데이터 폴더(또는 표 파일)만
76
+ z.write(full, os.path.relpath(full, base).replace(os.sep, "/"))
77
+ return buf.getvalue()
78
+
79
+
80
+ def summary(studio: Studio) -> str:
81
+ """보관함 목록에 보일 한 줄 요약."""
82
+ st = studio.label.state()
83
+ c = st["counts"]
84
+ kind = {"series_folder": "시계열", "image_folder": "이미지", "table": "표"}.get(st["source"]["kind"], "")
85
+ schema = {"class": "클래스", "number": "숫자", "segments": "구간", "boxes": "도형"}.get(st["schema"], "")
86
+ return json.dumps({"kind": st["source"]["kind"], "schema": st["schema"], "text": f"{kind} · {schema} 정답",
87
+ "total": c["total"], "labeled": c["labeled"], "unconfirmed": c["unconfirmed"],
88
+ "classes": [k["name"] for k in st["classes"]]}, ensure_ascii=False)
89
+
90
+
91
+ def _unpack(studio: Studio, data_path: str, work: str) -> str:
92
+ """데이터 사본 zip과 정답 JSON을 새 자리(/data/L<번호>/)에 풀고 작업 파일 경로를 돌려줌."""
93
+ root = _new_root()
94
+ base = f"{web.DATA_DIR}/{root}"
95
+ base_n = os.path.normpath(base)
96
+ os.makedirs(base, exist_ok=True)
97
+ if data_path:
98
+ with zipfile.ZipFile(data_path) as z:
99
+ for n in z.namelist():
100
+ if n.endswith("/"):
101
+ continue
102
+ target = os.path.normpath(os.path.join(base, n))
103
+ if not target.startswith(base_n + os.sep):
104
+ continue # zip 안의 ../ 같은 경로는 무시
105
+ os.makedirs(os.path.dirname(target), exist_ok=True)
106
+ with open(target, "wb") as f:
107
+ f.write(z.read(n))
108
+ try:
109
+ meta = json.loads(work)
110
+ path = meta["source"]["path"]
111
+ except (ValueError, KeyError, TypeError):
112
+ raise UserError("라벨링 작업을 읽을 수 없음", "작업이 손상되었을 수 있습니다") from None
113
+ m = re.match(re.escape(_MARK) + r"([uL]\d+)(/.*)?$", path)
114
+ if not m:
115
+ raise UserError("라벨링 작업의 데이터 자리를 알 수 없음", "작업을 다시 만드세요")
116
+ meta["source"]["path"] = base + (m.group(2) or "")
117
+ file = f"{base}/{WORK}"
118
+ with open(file, "w", encoding="utf-8") as f:
119
+ f.write(json.dumps(meta, ensure_ascii=False))
120
+ return file
121
+
122
+
123
+ @_wrap
124
+ def open_job(studio: Studio, data_path: str, work: str) -> dict:
125
+ """보관함의 작업을 라벨링 페이지에서 엶."""
126
+ file = _unpack(studio, data_path, work)
127
+ code, r = studio.call("POST", "/api/label/open", {"file": file})
128
+ if code != 200:
129
+ e = r["error"]
130
+ raise UserError(e["message"], e.get("hint", ""), e.get("issues"))
131
+ return r
132
+
133
+
134
+ @_wrap
135
+ def use_job(studio: Studio, data_path: str, work: str, confirmed_only: bool = False) -> dict:
136
+ """보관함의 작업을 studio 학습 데이터로: 풀고 → 정답 표를 만들어 → 데이터로 불러옴 (② 라벨링한 데이터)."""
137
+ from blocklearning.labeling import LabelProject
138
+ file = _unpack(studio, data_path, work)
139
+ p = LabelProject.open(file)
140
+ r = studio._label_use(p, bool(confirmed_only), None)
141
+ return _clean({"summary": r["summary"], "source": r["source"]})
142
+
143
+
144
+ @_wrap
145
+ def export_file(studio: Studio, op: str, body_json: str) -> dict:
146
+ """내보내기(정답 표·정상 목록·COCO·YOLO·나누기)를 /out/ 아래에 쓰고, 내려받을 파일 [(이름, 경로)]을 돌려줌."""
147
+ b = json.loads(body_json or "{}")
148
+ p = studio.label
149
+ if p is None:
150
+ raise UserError("라벨링 작업이 없음", "작업을 새로 만들거나 여세요")
151
+ out = f"{OUT}/{_new_root()}"
152
+ os.makedirs(out, exist_ok=True)
153
+ name = str(b.get("name") or "labels").replace("/", "_")
154
+ co = bool(b.get("confirmed_only"))
155
+ if op == "export":
156
+ f = f"{out}/{name}_정답.csv"
157
+ n = p.export(f, co)
158
+ return {"files": [[os.path.basename(f), f]], "rows": n}
159
+ if op == "export_normals":
160
+ f = f"{out}/{name}_정상목록.csv"
161
+ return {"files": [[os.path.basename(f), f]], "rows": p.export_normals(f, co)}
162
+ if op == "export_coco":
163
+ f = f"{out}/{name}_coco.json"
164
+ p.export_coco(f, co)
165
+ return {"files": [[os.path.basename(f), f]]}
166
+ if op == "export_yolo":
167
+ d = f"{out}/{name}_yolo"
168
+ n = p.export_yolo(d, co)
169
+ z = f"{out}/{name}_yolo.zip"
170
+ with zipfile.ZipFile(z, "w") as zf:
171
+ for dirpath, _, files in os.walk(d):
172
+ for fn in files:
173
+ full = os.path.join(dirpath, fn)
174
+ zf.write(full, os.path.relpath(full, d).replace(os.sep, "/"))
175
+ return {"files": [[os.path.basename(z), z]], "boxes": n}
176
+ if op == "split": # 나눈 작업마다 데이터 사본까지 든 묶음 (받는 사람이 그대로 열게)
177
+ parts = p.split(int(b.get("n", 2)))
178
+ data = data_bytes(studio)
179
+ files = []
180
+ for i, f in enumerate(parts):
181
+ meta = json.loads(open(f, encoding="utf-8").read())
182
+ os.remove(f)
183
+ z = f"{out}/{name}_part{i + 1}.dllabel.zip"
184
+ with open(z, "wb") as fh:
185
+ fh.write(_bundle(_portable(meta, p.file), data))
186
+ files.append([os.path.basename(z), z])
187
+ return {"files": files}
188
+ if op == "bundle": # 작업 내려받기: 정답 + 데이터 사본 (다른 PC·다른 사람이 그대로 엶)
189
+ z = f"{out}/{name}.dllabel.zip"
190
+ with open(z, "wb") as fh:
191
+ fh.write(bundle_bytes(studio))
192
+ return {"files": [[os.path.basename(z), z]]}
193
+ raise UserError(f"내보내기 '{op}'을(를) 모름", "")
194
+
195
+
196
+ def _portable(meta: dict, file: str) -> dict:
197
+ root = _root(file)
198
+ meta = json.loads(json.dumps(meta, ensure_ascii=False))
199
+ meta["source"]["path"] = meta["source"]["path"].replace(f"{web.DATA_DIR}/{root}", _MARK + root, 1)
200
+ return meta
201
+
202
+
203
+ def _bundle(meta: dict, data: bytes) -> bytes:
204
+ buf = io.BytesIO()
205
+ with zipfile.ZipFile(buf, "w", compression=zipfile.ZIP_DEFLATED) as z:
206
+ z.writestr("work.json", json.dumps(meta, ensure_ascii=False))
207
+ with zipfile.ZipFile(io.BytesIO(data)) as d:
208
+ for n in d.namelist():
209
+ z.writestr("data/" + n, d.read(n))
210
+ return buf.getvalue()
211
+
212
+
213
+ def bundle_bytes(studio: Studio) -> bytes:
214
+ """작업 묶음 (.dllabel.zip): work.json(정답, 옮길 수 있는 경로) + data/(데이터 사본)."""
215
+ return _bundle(json.loads(work_text(studio)), data_bytes(studio))
216
+
217
+
218
+ def _read_bundle(path: str) -> tuple:
219
+ """묶음 zip → (정답 JSON 글자, data/ 아래를 뽑은 zip 경로)."""
220
+ try:
221
+ z = zipfile.ZipFile(path)
222
+ except zipfile.BadZipFile:
223
+ raise UserError("라벨링 작업 묶음(.dllabel.zip)이 아님", "라벨링 페이지에서 [작업 내려받기]로 받은 파일을 고르세요") from None
224
+ with z:
225
+ if "work.json" not in z.namelist():
226
+ raise UserError("라벨링 작업 묶음이 아님 (work.json 없음)", "라벨링 페이지에서 [작업 내려받기]로 받은 파일을 고르세요")
227
+ work = z.read("work.json").decode("utf-8")
228
+ data = path + ".data.zip"
229
+ with zipfile.ZipFile(data, "w", compression=zipfile.ZIP_STORED) as d:
230
+ for n in z.namelist():
231
+ if n.startswith("data/") and not n.endswith("/"):
232
+ d.writestr(n[5:], z.read(n))
233
+ return work, data
234
+
235
+
236
+ @_wrap
237
+ def open_bundle(studio: Studio, path: str) -> dict:
238
+ """작업 묶음 가져오기 → 라벨링 페이지에서 엶 (보관함에는 부르는 쪽이 새로 저장)."""
239
+ work, data = _read_bundle(path)
240
+ file = _unpack(studio, data, work)
241
+ code, r = studio.call("POST", "/api/label/open", {"file": file})
242
+ if code != 200:
243
+ e = r["error"]
244
+ raise UserError(e["message"], e.get("hint", ""), e.get("issues"))
245
+ return r
246
+
247
+
248
+ @_wrap
249
+ def merge_file(studio: Studio, path: str) -> dict:
250
+ """다른 사람의 작업(묶음 .dllabel.zip 또는 .dllabel) 합치기: 데이터 자리를 지금 작업으로 맞춘 뒤 합침."""
251
+ p = studio.label
252
+ if p is None:
253
+ raise UserError("라벨링 작업이 없음", "작업을 새로 만들거나 여세요")
254
+ try:
255
+ work = _read_bundle(path)[0] if zipfile.is_zipfile(path) else open(path, encoding="utf-8").read()
256
+ other = json.loads(work)
257
+ other["source"]["path"] = p.meta["source"]["path"]
258
+ except (ValueError, KeyError, TypeError, UnicodeDecodeError):
259
+ raise UserError("다른 사람의 작업을 읽을 수 없음", "라벨링 작업 묶음(.dllabel.zip)이나 작업 파일(.dllabel)을 고르세요") from None
260
+ tmp = f"{OUT}/merge_{_new_root()}.dllabel"
261
+ os.makedirs(OUT, exist_ok=True)
262
+ with open(tmp, "w", encoding="utf-8") as f:
263
+ f.write(json.dumps(other, ensure_ascii=False))
264
+ r = p.merge(tmp)
265
+ return _clean(dict(p.state(), **r))
266
+
267
+
268
+ def file_path(studio: Studio, name: str) -> str:
269
+ """그림 작업의 원본 그림 경로 (크게 보기: 브라우저가 이 파일을 읽어 보여 줌)."""
270
+ if studio.label is None:
271
+ raise UserError("라벨링 작업이 없음", "")
272
+ return str(studio.label.file_path(name))
273
+
274
+
275
+ # ------------------------------------------------------------ 딥러닝 제안 (웹: 학습은 화면의 엔진이, 데이터 준비·적용은 여기서)
276
+ _deep = {}
277
+
278
+
279
+ @_wrap
280
+ def deep_prepare(studio: Studio) -> dict:
281
+ """정답 붙은 샘플로 학습할 데이터와 계획을 준비 (엔진이 deep_payload로 값을 가져감)."""
282
+ from blocklearning import codegen
283
+ from blocklearning.core import deep_graph, graph_name
284
+ p = studio.label
285
+ if p is None:
286
+ raise UserError("라벨링 작업이 없음", "작업을 새로 만들거나 여세요")
287
+ prep = p.deep_data()
288
+ d = prep["data"]
289
+ _deep.clear()
290
+ _deep.update(prep)
291
+ plan = codegen.plan_dict(deep_graph(prep["kind"]), d.length, d.n_out, d.image)
292
+ return {"plan": plan, "model": graph_name(prep["kind"]), "n_pred": len(prep["targets"]),
293
+ "classes": [str(c) for c in d.classes]}
294
+
295
+
296
+ def deep_payload() -> dict:
297
+ """엔진 학습용 값: web.data_payload와 같은 모양 + 제안할 값 X_pred."""
298
+ d = _deep["data"]
299
+ f32 = lambda a: np.ascontiguousarray(a, dtype=np.float32).tobytes()
300
+ return {"X_train": f32(d.X_train), "X_test": f32(d.X_test), "y_train": f32(d.y_train), "y_test": f32(d.y_test),
301
+ "X_pred": f32(_deep["X_pred"]),
302
+ "meta": json.dumps({"n_train": int(len(d.y_train)), "n_test": int(len(d.y_test)), "n_features": int(d.X_train.shape[1]),
303
+ "task": d.task, "n_out": int(d.n_out), "length": int(d.length),
304
+ "image": list(d.image) if d.image else None, "n_pred": len(_deep["targets"])})}
305
+
306
+
307
+ @_wrap
308
+ def deep_apply(studio: Studio, probs_bytes, acc) -> dict:
309
+ """엔진이 낸 확률 (제안할 샘플 수 × 클래스 수) → 모델 제안으로 붙임."""
310
+ raw = probs_bytes.to_bytes() if hasattr(probs_bytes, "to_bytes") else bytes(probs_bytes)
311
+ d = _deep["data"]
312
+ P = np.frombuffer(raw, dtype=np.float32).reshape(len(_deep["targets"]), -1)
313
+ r = studio.label.apply_model(_deep["targets"], list(d.classes), P)
314
+ trained = int(len(d.y_train) + len(d.y_test))
315
+ _deep.clear()
316
+ return _clean(dict(studio.label.state(), **r, acc=None if acc is None else float(acc), trained_on=trained))
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: blocklearning
3
+ Version: 0.1.0
4
+ Summary: 블록을 이어 딥러닝 모델을 만들고 학습하는 브라우저 화면 도구 (PyTorch, 내 PC의 GPU로 학습)
5
+ Project-URL: Homepage, https://jeon-stat.github.io/blocklearning/
6
+ Project-URL: Source, https://github.com/jeon-stat/blocklearning
7
+ Project-URL: Issues, https://github.com/jeon-stat/blocklearning/issues
8
+ Author: jeon-stat
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ License-File: src/blocklearning/pretrained/LICENSE-mnv3s.txt
12
+ Keywords: deep learning,education,no-code,pytorch,visual programming
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Education
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Natural Language :: Korean
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: numpy>=1.24
22
+ Requires-Dist: pillow>=9
23
+ Requires-Dist: torch>=2.0
24
+ Provides-Extra: image
25
+ Description-Content-Type: text/markdown
26
+
27
+ # BlockLearning
28
+
29
+ 파이썬·딥러닝 코드를 몰라도 브라우저 화면에서 **층(블록)을 선으로 이어** 모델을 만들고, 학습하고, 학습한 모델을 파일로 내보내는 도구입니다.
30
+ 시계열(센서·심전도)·표 데이터와 흑백 이미지를 다룹니다.
31
+
32
+ - 설치 없이 써 보기: https://jeon-stat.github.io/blocklearning/ (계산은 브라우저 안에서)
33
+ - 이 패키지: 같은 화면을 내 PC에 띄우고, 학습은 **PyTorch로 내 PC에서** 합니다. NVIDIA 그래픽카드가 있으면 GPU로 학습합니다.
34
+
35
+ > 교육·실험용 도구입니다. 학습 결과를 의료 진단이나 제조 판정 같은 실제 결정에 그대로 쓰지 마세요.
36
+
37
+ ## 설치
38
+
39
+ Python 3.10 이상이 필요합니다.
40
+
41
+ ```
42
+ pip install blocklearning
43
+ ```
44
+
45
+ **NVIDIA GPU로 학습하려면** 먼저 GPU용 PyTorch를 깔고 나서 위 명령을 실행하세요.
46
+ [pytorch.org](https://pytorch.org/get-started/locally/)에서 내 PC(운영체제·CUDA)에 맞는 `pip install torch ...` 명령을 골라 실행하면 됩니다.
47
+ 그냥 `pip install blocklearning`만 하면 (Windows에서는) CPU용 PyTorch가 깔려 CPU로 학습합니다.
48
+
49
+ ## 실행
50
+
51
+ ```
52
+ blocklearning
53
+ ```
54
+
55
+ 브라우저에 `http://127.0.0.1:8765/`가 열립니다. 이 PC 안에서만 열리고(`127.0.0.1`), 데이터는 PC 밖으로 나가지 않습니다.
56
+ 끝내려면 명령창에서 Ctrl+C. 실행 파일이 회사 정책 등으로 막히면 `python -m blocklearning`.
57
+
58
+ - `--port 8800`: 다른 포트로
59
+ - `--no-browser`: 브라우저를 자동으로 열지 않음
60
+
61
+ ## 할 수 있는 것
62
+
63
+ ① 과제 고르기 → ② 데이터 (CSV·이미지 폴더·예시 데이터) → ③ 블록으로 모델 → ④ 학습 → ⑤ 새 데이터로 예측.
64
+ 분류·회귀·이상 탐지·시계열 예측·구간 분할·물체 찾기·여러 정답 동시에. 학습한 모델은 PyTorch 코드나 TorchScript 파일로 내보낼 수 있습니다.
65
+
66
+ 소스·자세한 설명: https://github.com/jeon-stat/blocklearning · 라이선스: MIT (예시 데이터와 사전학습 가중치는 각자의 라이선스, 패키지 안 `*.SOURCE.txt`·`LICENSE-mnv3s.txt`)
@@ -0,0 +1,74 @@
1
+ blocklearning/__init__.py,sha256=qEXZsgmjdaFv53z7aCP9jgnSBNEmy00WOIA41FVG2yY,159
2
+ blocklearning/__main__.py,sha256=fPWmURk1Y4ibzEBiRCLC6Z3siSg_UAMTAC_rtXKYucw,135
3
+ blocklearning/analysis.py,sha256=yvOWHY3yEncEiKv9YuDeVYa6ctkBeNePVveVqm5U2EU,6163
4
+ blocklearning/anomaly.py,sha256=qYBMC27H2N5whVzGHA5t-g3f-TVwFpuIcVtVMDugWRc,8521
5
+ blocklearning/blocks.py,sha256=tCHMiVzTxMDf7x8VFqkMLsTeCP2DLmaty-FOHw6ncZo,31570
6
+ blocklearning/cli.py,sha256=Mjy2bRflDQmx_DplyUaWdK_JDtFHzSMyN0PxTJFwjs8,1578
7
+ blocklearning/codegen.py,sha256=Vejva8u4FWzRff9WvQ-_Ufyk_PMPTmszcV1z9-0CQJI,61383
8
+ blocklearning/core.py,sha256=kyu9hCNY33POZXyUpUKwGlDN_ClkT1rDmfiLZOFuVfk,50467
9
+ blocklearning/data.py,sha256=rDEzUK_2Ax8QNyN86Y7vw2NFncxv8a8NbE1ZFYIrJZU,69843
10
+ blocklearning/detect.py,sha256=6_ceGlaAuNg3cDrUg8GzWEs92Ajd4KLCWIvAizm9SS8,10519
11
+ blocklearning/forecast.py,sha256=JhIsCoLxlBgmkV_uPc_gD-UF_Om9aECAlPaCCJUKKr0,11291
12
+ blocklearning/graph.py,sha256=lEfZWKvPRxua1NxJuDkz5KFbmVYKvhHPVJS116rSZVs,29016
13
+ blocklearning/jobs.py,sha256=hdFml2-98yEGgrZ12WfgMprKCXzzi5Xx7PGua0_AQm4,25175
14
+ blocklearning/labeling.py,sha256=2DRr6cXSkYyxPnADnaVrDKYU1yU3XkkPlxduq-nN6AQ,73919
15
+ blocklearning/labeling_sources.py,sha256=nPP5xbDEm4AdzvnU2jiIG3gS5jgIVEl3AuvoGV9btoI,10053
16
+ blocklearning/layers.py,sha256=smCG6W8or4o87j6db0nBZcQHcyryVgzRnsATYxD-6X0,31660
17
+ blocklearning/losses.py,sha256=cxIUjWEaSrE3BnQgCyyjWjZLAippErFCcdF6H8Tq12E,9918
18
+ blocklearning/multi.py,sha256=OeVIFFjT8HP_siZRL3QaWn1DRF7e_iYV2GZg07tniB8,8868
19
+ blocklearning/nn_extra.py,sha256=_fQZK8boZHX1deGagc-mW2ZDjQQG_23Jp_4lpbGqzPo,26292
20
+ blocklearning/predict.py,sha256=soEDP2eh1aghI_pxJu01pW1dyT9N1PiQn73UfQ1jTjo,18870
21
+ blocklearning/pretrained.py,sha256=1eTW375mZzGjW2cA5mEuSGW-zq4MV5xIBkLWunZ_MAk,2502
22
+ blocklearning/project.py,sha256=z_MA0SvAS9hjmYA-FxpppOIZUU4as5qe60BnItmooVo,7330
23
+ blocklearning/segment.py,sha256=Y8uHjcjSjsUcvI9vu2KNAJv0hiCbydyWlm06p28ABUA,9770
24
+ blocklearning/server.py,sha256=8-KwmQ3Sb8GJlYq4mmtPBJFGcXvXbbRFqHDyH21_dKY,5210
25
+ blocklearning/tasks.py,sha256=ANxwYjk9uINLzla8Tl5maIf-7Mf_1mB57PyyES14xzo,26111
26
+ blocklearning/web.py,sha256=ZCh5KJ435MXdJG76sAlCsjIG68XBTNanIbb3LYxRn-0,21781
27
+ blocklearning/weblabel.py,sha256=qkAClw4pMR1B5EHgUMcWClrqfnljw__DA-mkVNJcQAc,14377
28
+ blocklearning/data/bearing_uottawa.SOURCE.txt,sha256=OC7R2rkuDiJFHlGHeyZdjqe1Kb2pv0kWjqtx3aMeTNE,654
29
+ blocklearning/data/bearing_uottawa.npz,sha256=EmaWZ5YJ7Ol0bkJoae8LpRg5vg-tos5mNC50dxHnKq4,1138621
30
+ blocklearning/data/concrete.SOURCE.txt,sha256=K5w-PtYLstMB0TTMYIujuD68bC-4XqZcN7PQVASK1WU,504
31
+ blocklearning/data/concrete.npz,sha256=KNnZD9-wQHqu24wFvpSQ2S-GR2cyh-P8FshiFJfVR54,11344
32
+ blocklearning/data/digits32.SOURCE.txt,sha256=WhqB_BkTJsb4g5O3jbo5FCz15LtEEGy61En0cxPfrNw,434
33
+ blocklearning/data/digits32.npz,sha256=3jJKaiCUiES0XV0FqQW-s9SViBpMvFqbVRukbjELw1w,277184
34
+ blocklearning/data/ecg_mitdb.SOURCE.txt,sha256=RDg2o5wUr-J3tT_xj3pkIym-31kqPj23cfbUHv3qZGU,816
35
+ blocklearning/data/ecg_mitdb.npz,sha256=P7hLoZxTZIBr2cTBRmIH73ZyHgUREgybF7afGTRuQKc,1323506
36
+ blocklearning/data/hydraulic.SOURCE.txt,sha256=q7wfIWcLv9CNuXxjlk9VHEdQlYZDo0gXP88tgerwIjU,716
37
+ blocklearning/data/hydraulic.npz,sha256=wnJFX8tdAhyo92HtAJ0rG_w2XZkwtpW1cYJMjBd5mAQ,805383
38
+ blocklearning/data/pcb_det.SOURCE.txt,sha256=4yhBA60ptiX6VkQ8U8sVvl0ahji807bjrQ0b1qX8vbI,781
39
+ blocklearning/data/pcb_det.npz,sha256=yfcmLfdbmlohF31Jzh54E_q8CNeGOW9yPPr-Ux7lH94,5097191
40
+ blocklearning/data/pneumatic_seg.SOURCE.txt,sha256=wNAbmGVRXaZVm0c96lYvbX0XnNW36vOUgs7O4af6nZY,1006
41
+ blocklearning/data/pneumatic_seg.npz,sha256=FFvsBv4h5rf7bNMyZ_flOgFzgnTJoJ0IkwL0TuXCYXM,1066110
42
+ blocklearning/data/pneumonia28.SOURCE.txt,sha256=x08Fo74Ka6q-8b9EJDxbF_8E9qv72dFH9EqYPc5b2Wg,1104
43
+ blocklearning/data/pneumonia28.npz,sha256=b-pC5G1BpYC-c2e8tAFXNQxe37anO_zmt_rAZrYg-D4,866664
44
+ blocklearning/data/steel_plates.SOURCE.txt,sha256=hCZNhV4ahDVaJsl0ndqTwzZVqBmipvmtjqsTEa6D0Zs,580
45
+ blocklearning/data/steel_plates.npz,sha256=ZcdycR0OyDbmktNCI4C3mTAt6wJANPCJiuZx3yT7lL0,116177
46
+ blocklearning/data/steel_power.SOURCE.txt,sha256=PjlfoJVnvOL-2knN0FTt1EPdHTttxQWrbL3UtEQ2uvY,408
47
+ blocklearning/data/steel_power.npz,sha256=rEXiKXCjCSWFeuRSOGdOLo7zQqmlHCtPx0t1CF6uhyg,22813
48
+ blocklearning/data/steelblast.SOURCE.txt,sha256=Z0rtMyNWyDBwwobpGc9RVEQronC7iGTurURyT1kc2zo,554
49
+ blocklearning/data/steelblast.npz,sha256=Xw9o-dqOT6wK02ZpANOeQCuKk1LP79rpATM2wZO6VQI,5990847
50
+ blocklearning/pretrained/LICENSE-mnv3s.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
51
+ blocklearning/pretrained/mnv3s.SOURCE.txt,sha256=6WaaHw_auOIY_s-GAFxU1xluCptntKQbquFwhmLfbMA,809
52
+ blocklearning/pretrained/mnv3s.bin,sha256=TjNha5-i9XYlHOjVW1vyC1zkDLCkWCMDbqQrvJGQYl8,6047200
53
+ blocklearning/pretrained/mnv3s.json,sha256=cUnQxLfFCwqbTTR4ZUB6QAFuSD9wVVmz46mj0ATPP5U,3852
54
+ blocklearning/static/app.js,sha256=beQFNIrWFebd-TEtsAfazkfoKXVuKBBcVTJtvLpG1NE,140594
55
+ blocklearning/static/boot.js,sha256=Vb8eeJEaaJ5pv_rHw72NBLVf03Bom5FtoLm3sHkuHog,3752
56
+ blocklearning/static/demo.jpg,sha256=V5or0BwYTg5OH5f-xvQ4wtTmgPIho9InW06mb4Y7tKg,93932
57
+ blocklearning/static/demo.webm,sha256=c0czdHkb46jJYDw73dhc91_ZIR2D-3vvcizw3xbx8kQ,3155305
58
+ blocklearning/static/engine.js,sha256=mhxCtu-1ujWf5fjLaw0KSKlNAjHLG1FFKAh4qvbGotU,78380
59
+ blocklearning/static/graph.js,sha256=o9R2H48WnWgBAjB4MtW5gf81Jkd8Fmurbt0oBwOAApk,125930
60
+ blocklearning/static/index.html,sha256=U7wTbhZSS-oMqZWk3fni_wzWJZn_LUjO2WOamqeo76g,20909
61
+ blocklearning/static/label.html,sha256=oA2JGOLvLof3KQjedYZp7_mQpiF9dADN92o7j9lkGLw,12374
62
+ blocklearning/static/label.js,sha256=a0HW-T0SJyxMjg7r6rVY2RXYGasioP-dJVcOswnSdFs,72882
63
+ blocklearning/static/labels.js,sha256=9yajN3w2xo_v305Hdd59JfHfPSOuKVhUzL_30CQD-JI,13375
64
+ blocklearning/static/projects.js,sha256=hDsOeJS24g-jLvJ3bdNFGYUW192QijIUyQ0r_u1_MVM,32398
65
+ blocklearning/static/store.js,sha256=fjrWJDRhwGA3cS9zZFPSpdQJhVIHsfm1MAffh-sXxQ8,13632
66
+ blocklearning/static/style.css,sha256=56CdHcsMtqgE9pKHZmpIsYZUv9dYh1f7g6fhjZiWtdM,64933
67
+ blocklearning/static/train-worker.js,sha256=nkhEz9_XKIOQS9983QshhEsquPEDBAMK1NH0BPv2lHQ,2099
68
+ blocklearning/static/web.js,sha256=iqegWKb_yjiIw5Kz2Us09wrwzOlVCrbcRlox5mBJyl8,34515
69
+ blocklearning-0.1.0.dist-info/METADATA,sha256=l-bRhXHI2yFMePk_MaqDbbQqzo_JMC6IGtmbiwLWvQI,3249
70
+ blocklearning-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
71
+ blocklearning-0.1.0.dist-info/entry_points.txt,sha256=l87obg001gFl-OKr_6ZhxPMbfE4zKbDSfm0vKFxud2M,57
72
+ blocklearning-0.1.0.dist-info/licenses/LICENSE,sha256=X5QI3bhcIM6s-Cg5usqhP-84xdPIHtsC-D88z3gEjbs,1318
73
+ blocklearning-0.1.0.dist-info/licenses/src/blocklearning/pretrained/LICENSE-mnv3s.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
74
+ blocklearning-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ blocklearning = blocklearning.cli:main
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jeon-stat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Bundled third-party files keep their own licenses:
24
+ - src/blocklearning/data/*: public datasets (CC BY 4.0 or MIT); source and license in each *.SOURCE.txt
25
+ - src/blocklearning/pretrained/*: MobileNetV3-Small weights (Apache 2.0); see LICENSE-mnv3s.txt