WUT_Computer_Science/Programming/twm_4
Krzysztof kuhy Rudnicki 1fd1de2f82
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
runnability / runnability (push) Waiting to run
twm_4: zero findings, with the notebook's outputs proved untouched
228 ruff findings to 0 across the notebook, its partial export and twm.py, and
mypy --strict is clean on both .py files.

A notebook is a deliverable that happens to contain code, so the check that
mattered was not "does it still run" -- it needs a GPU, MNIST, CIFAR-10 and a
slice of Quick, Draw! to run at all -- but "is anything except the code still
exactly as submitted". Hashing every key of the .ipynb EXCEPT cell `source`
gives 60242e116d12549d11c93f7f before the first edit and after the last one,
across four passes and a `ruff format`. The file also round-trips byte-for-byte
through json.dumps(indent=1, ensure_ascii=False), which is what made editing
cells programmatically safe rather than a reformat of all 141 of them; the
diff touches 38.

print() became sys.stdout.write() rather than logging. In a notebook the print
IS the output, and a logger with no handler configured would have silently
emptied every cell -- the exact regression scripts/check_refactor_safety.py
was written for. matprint's `print(x, end="  ")` and bare `print()` are
preserved as writes with and without a trailing newline.

Both `show_samples` and `show_samples_rgb` took (indices, preds, images,
labels, count, names), which is six arguments and a mutable default. They now
take a frozen `Samples` holding the last four, which also removed the same
four-value tuple from seven call sites. Reviewing that diff is how I caught
that I had transcribed `real_score = preds[sample][real_id]` as
`samples.labels[sample]` -- a bug I introduced and then fixed before commit.

Other real things, not just rule satisfaction: `np.in1d` is removed in NumPy 2
(NPY201) and is now `np.isin(...).ravel()`; `test_model` computed
correct_indices and incorrect_indices and used neither; two cells grew `img`
inside a loop so it was only bound by the `else` branch; and the Quick, Draw!
downloader now builds a URL whose https scheme is a literal, which is what
S310 was asking for.

The README claimed the .py was "an nbconvert export of that notebook". It is
an export of the CIFAR-10 section only -- 28 of 81 code cells -- and has been
edited since. It says that now, and says the two are separate artifacts rather
than one being regenerable from the other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 08:10:31 +02:00
..
.gitignore Add 'Programming/twm_4/' from commit '1ae0cf4d68ba652fbc390720bd18bb9b604dd119' 2026-02-06 22:15:03 +01:00
README.md twm_4: zero findings, with the notebook's outputs proved untouched 2026-08-29 08:10:31 +02:00
run.sh Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
TWM_KerasIntro.ipynb twm_4: zero findings, with the notebook's outputs proved untouched 2026-08-29 08:10:31 +02:00
TWM_KerasIntro.py twm_4: zero findings, with the notebook's outputs proved untouched 2026-08-29 08:10:31 +02:00
twm.py twm_4: zero findings, with the notebook's outputs proved untouched 2026-08-29 08:10:31 +02:00

TWM — lab 4: introduction to Keras

Coursework for TWM (Techniki Wizyjne / machine vision), lab 4.

Path What it is
TWM_KerasIntro.ipynb The submitted notebook — the deliverable.
TWM_KerasIntro.py An nbconvert export of the notebook's CIFAR-10 section only.
twm.py Prints the TensorFlow version the notebook will run against.

The notebook is the source of truth. The .py is kept because it makes that section's code reviewable and diffable, but it is not a full export: it covers 28 of the notebook's 81 code cells, all of them from the CIFAR-10 half, and it has been edited since. Treat the two as separate artifacts rather than regenerating one from the other.

Both need a GPU. The notebook's first cell calls sys.exit() when TensorFlow reports no physical GPU device, and running it end to end downloads MNIST, CIFAR-10 and a slice of the Quick, Draw! bitmaps into data/.