Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Simple MNIST and EMNIST data parser written in pure Python.
MNIST is a database of handwritten digits available on http://yann.lecun.com/exdb/mnist/. EMNIST is an extended MNIST database https://www.nist.gov/itl/iad/image-group/emnist-dataset.
git clone https://github.com/sorki/python-mnist
cd python-mnist
Get MNIST data:
::
./bin/mnist_get_data.sh
Check preview with:
::
PYTHONPATH=. ./bin/mnist_preview
Get the package from PyPi:
::
pip install python-mnist
or install with setup.py
:
::
python setup.py install
Code sample:
::
from mnist import MNIST mndata = MNIST('./dir_with_mnist_data_files') images, labels = mndata.load_training()
To enable loading of gzip-ed files use:
::
mndata.gz = True
Library tries to load files named t10k-images-idx3-ubyte train-labels-idx1-ubyte train-images-idx3-ubyte and t10k-labels-idx1-ubyte. If loading throws an exception check if these names match.
Get EMNIST data:
::
./bin/emnist_get_data.sh
Check preview with:
::
PYTHONPATH=. ./bin/emnist_preview
To use EMNIST datasets you need to call:
::
mndata.select_emnist('digits')
Where digits is one of the available EMNIST datasets. You can choose from
EMNIST loader uses gziped files by default, this can be disabled by by setting:
::
mndata.gz = False
You also need to unpack EMNIST files as bin/emnist_get_data.sh script won't do it for you. EMNIST loader also needs to mirror and rotate images so it is a bit slower (If this is an issue for you, you should repack the data to avoid mirroring and rotation on each load).
This package doesn't use numpy by design as when I've tried to find a working implementation all of them were based on some archaic version of numpy and none of them worked. This loads data files with struct.unpack instead.
::
$ PYTHONPATH=. ./bin/mnist_preview Showing num: 3
............................ ............................ ............................ ............................ ............................ ............................ .............@@@@@.......... ..........@@@@@@@@@@........ .......@@@@@@......@@....... .......@@@........@@@....... .................@@......... ................@@@......... ...............@@@@@........ .............@@@............ .............@.......@...... .....................@...... .....................@@..... ....................@@...... ...................@@@...... .................@@@@....... ................@@@@........ ....@........@@@@@.......... ....@@@@@@@@@@@@............ ......@@@@@@................ ............................ ............................ ............................ ............................
FAQs
Simple MNIST and EMNIST data parser written in pure Python
We found that python-mnist demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.