Scrivevo un anno e mezzo fa:
In uno dei suoi tremila blog ieri Google ha annunciato anche un nuovo interessante progetto open source chiamato Magika. Serve a identificare il tipo di un file in automatico e si basa su un modello deep learning molto piccolo e molto efficiente, con tempi di inferenza di pochi millisecondi anche su CPU.
Finora il riconoscimento del tipo di un file era basato sul suo nome (es. estensione .pdf) o sull'analisi dei "magic byte", delle sequenze binarie presenti all'inizio dei file che in molti casi ne permettono l'identificazione. Magika è però di gran lunga superiore rispetto a queste tecniche, con le metriche precision, recall e F1 che superano il 99% e per alcuni tipi di file raggiungono il 100%.
Magika si può usare facilmente con Python o JavaScript, infatti la demo ufficiale funziona nel browser: https://google.github.io/magika/
Ora Magika ha raggiunto la 1.0:
Today, we are happy to announce the release of Magika 1.0, a first stable version that introduces new features and a host of major improvements since last announcement. Here are the highlights:
- Expanded file type support for more than 200 types (up from ~100). -A brand-new, high-performance engine rewritten from the ground up in Rust.
- A native Rust command-line client for maximum speed and security.
- Improved accuracy for challenging text-based formats like code and configuration files.
- A revamped Magika Python and TypeScript module for even easier integrations.
Prestazioni notevoli:
Magika is able to identify hundreds of files per second on a single core and easily scale to thousands per second on modern multi-core CPUs thanks to the use of the high-performance ONNX Runtime for model inference and Tokio for asynchronous parallel processing, For example, as visible in the chart below, on a MacBook Pro (M4), Magika processes nearly 1,000 files per second.