Benchmark & Pretraining for Cartesian coordinates feature extraction
Project description
cartesius
Benchmark for Cartesian coordinates feature extraction
Description • Install • Usage • Documentation • Contribute
Description
This repository contains the data for training & benchmarking neural networks on various tasks, with the goal to evaluate feature extraction capabilities of benchmarked models.
Extracting features 2D polygons is not a trivial task. Many models can be applied to this task, and many approaches exist (learning from raw coordinates, learning from a raster image, etc...).
So it's necessary to have a benchmark, in order to quantify and see which model/approach is the best.
Install
Install cartesius
by running :
pip install spwk-cartesius
Usage
In cartesius
, the training data is polygons that are randomly generated.
Let's have a look. First, initialize the training set :
from cartesius.data import PolygonDataset
train_data = PolygonDataset(
x_range=[-50, 50], # Range for the center of the polygon (x)
y_range=[-50, 50], # Range for the center of the polygon (y)
avg_radius_range=[1, 10], # Average radius of the generated polygons. Here it will either generate polygons with average radius 1, or 10
n_range=[6, 8, 11], # Number of points in the polygon. here it will either generate polygons with 6, 8 or 11 points
)
Then, we will take a look at the generated polygon :
import matplotlib.pyplot as plt
from cartesius.utils import print_polygon
def disp(*polygons):
plt.clf()
for p in polygons:
print_polygon(p)
plt.gca().set_aspect(1)
plt.axis("off")
plt.show()
polygon, labels = train_data[0]
disp(polygon)
print(labels)
The benchmark relies on various tasks : predicting the area of a polygon, its perimeter, its centroid, etc... (see the documentation for more details)
The goal of the benchmark is to write an encoder : a model that can encode a polygon's features into a vector.
After the feature vector is extracted from the polygon using the encoder, several heads (one per task) will predict the labels. If the polygon is well represented through the extracted features, the task-heads should have no problem predicting the labels.
The notebooks/
folder contains a notebook that implements a Transformer model, trains it on cartesius
data, and evaluate it. You can use this notebook as a model for further research.
Note : At the end of the notebook, a file submission.csv
is saved, you can use it for the Kaggle competition.
Contribute
To contribute, install the package locally, create your own branch, add your code/tests/documentation, and open a PR !
Unit tests
When you add some feature, you should add tests for it and ensure the previous tests pass :
python -m pytest -W ignore::DeprecationWarning
Linters & formatters
Your code should be linted and properly formatted :
isort . && yapf -ri . && pylint cartesius && pylint tests --disable=redefined-outer-name
Documentation
The documentation should be kept up-to-date. You can visualize the documentation locally by running :
mkdocs serve
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spwk-cartesius-0.1.0.tar.gz
.
File metadata
- Download URL: spwk-cartesius-0.1.0.tar.gz
- Upload date:
- Size: 137.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e15af966171108423060397f24a93e6aa5ac1cb178f226bb455bee991f8d493 |
|
MD5 | 2bc7e7e24784dbc805663632d75c1c79 |
|
BLAKE2b-256 | f6323a939a7b841a8f3efb06ed7abf68a0cbf81cea2d1e8ec17275f9de9c75f3 |
File details
Details for the file spwk_cartesius-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: spwk_cartesius-0.1.0-py3-none-any.whl
- Upload date:
- Size: 137.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b784dee294314319d0b803d20c41604ac8f1067a18e26357bf970e79b534e143 |
|
MD5 | 985206fdb5b81b00387c6ef7d583f608 |
|
BLAKE2b-256 | d3cb9a353d8ef6fa006568d7797e1f727e1de4c96f020d0c49a56b786e7eb390 |