Git Product home page Git Product logo

detypify's Issues

Unfriendly use as a library/package

We need an extra step to download detypify assets. What's worse is that we should keep in mind and update the assets on detypify upgrade its pre-trained model.

Myriad-Dreamin/tinymist#260

Possible solution: publish and install it via npm: yarn add detypify

import {Detypify} from 'detypify';
console.log((await Detypify.create()).candidates(strokes));

https://github.com/Myriad-Dreamin/tinymist/blob/01f72c3d75b099afff7ff59c394067e57b79027a/tools/editor-tools/src/features/symbol-view.detypify.ts

[Discussion] Stroke-based model?

The original training data come from Detexify is in the form of strokes that can be described as follows:

type Point = tuple[float, float, int]  # (x, y, timestamp)
type Stroke = list[Point]
type Strokes = list[Stroke]

The implementation of Detexify is KNN where distances are calculated by Greedy DTW. This model is too large to ship with the website. Besides, I don't know how to handle variable-length inputs. Therefore, I found another way.

Current model of Detypify (0.1.0) is naive CNN. It first normalizes strokes (center + scale), then draw them on a 32x32 canvas (pixelated, no anti-aliasing), then CNN. This approach has some drawbacks:

  • It cannot distinguish prime.rev and backslash very well. Normalization makes them look the same. There might be more such examples.
  • It cannot recognize uncommon symbols very well. This is more related to the problem of training data, which is extremely unbalanced: the numbers of samples vary from 10- to 3900+. But it seems like Detexify can recognize them.

Could a stroke-based model be better? If so, which model should I use?

Or, is there any potential improvement to the current model?

[Discussion] Lack of training data

Currently, all training data come from Detexify. The dataset is extremely unbalanced. Some symbols have more than 3900 samples, while some have less than 10 samples. Many uncommon symbols are nearly untrained.

Apart from that, due to the difference between LaTeX and Typst, some Typst symbols don't even have corresponding samples in Detexify's training data. For example, the join series (there's only \bowtie).

That is to say, we really need contributions from the community. Here comes the question: I don't know which platform is suitable for this need.

In addition to that, we can probably explore some data augmentation methods to enhance the training set. And unfortunately, I know nothing about that as well.

How to draw a ℘?

How to draw a $\wp$ (\wp, ℘) ? At present, it seems that all inputs of the trajectory will be recognized as φ and other results. Is this because the dataset does not contain ℘?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.