semvec/pypi-packages huggingface dataset:
pdf-image-cropper 0.1.6
Crop pdf and conver to png
License: MIT
Requires Python: >=3.7
Keywords: pdf crop png

# pdfcropper

`pdf-image-cropper` is a tool to crop pdf files and converting them into png files.

## Installation

You can install `pdf-image-cropper` by cloning this repository or by using [Pip](http://pypi.python.org/pypi/pip):

```sh
$ pip install pdf-image-cropper
```

If you want to use the development version, you can install directly from github:

```sh
$ pip install -e git+git://gitlab.com/ali7line/awesome-scripts/-/tree/master/pdf-image-cropper
```

If using, the development version, you might want to install dependencies as well:

```
$ pip install -r requirements.txt
```

**NOTE**: Only tested in Python **3.7.9**

## Usage

Just run `pdfcropper --help` to see the commands available options.

The list of options available are:

* `--config=<FILE>` to specify your yaml config file to use
* `--sample-config=<FILE>` writres sample yaml config file with default options
pytopk 0.1.0
Pytorch implementation of a differentiable topk function, a balanced and imbalanced top-k loss for deep learning
License: MIT
Keywords: topk,deep learning,pytorch,differentiable

This is the code of the paper [Stochastic smoothing of the top-K calibrated hinge loss for deep imbalanced classification](https://proceedings.mlr.press/v162/garcin22a/garcin22a.pdf) published at ICML2022.
If you use this code for your work, please cite the paper:
```
@inproceedings{pmlr-v162-garcin22a,
  title = 	 {Stochastic smoothing of the top-K calibrated hinge loss for deep imbalanced classification},
  author =       {Garcin, Camille and Servajean, Maximilien and Joly, Alexis and Salmon, Joseph},
  booktitle = 	 {Proceedings of the 39th International Conference on Machine Learning},
  pages = 	 {7208--7222},
  year = 	 {2022},
  volume = 	 {162},
  series = 	 {Proceedings of Machine Learning Research},
  month = 	 {17--23 Jul},
  publisher =    {PMLR},
}
```

## The pytopk package

The pytopk package contains the code for the balanced and imbalanced top-k losses as well as a differentiable top-k function.

### Installation
It can be installed as follows:

```console
pip install pytopk
```

### Top-k losses

Our losses can be used as standard pytorch loss functions:

```python
import torch
from pytopk import BalNoisedTopK, ImbalNoisedTopK

scores = torch.tensor([[2.0, 1.5, -3.0],
                       [7.5, 4.0, -1.5]])
labels = torch.tensor([0, 2])

k = 2

criteria_bal = BalNoisedTopK(k=k, epsilon=1.0)
criteria_imbal = ImbalNoisedTopK(k=k, epsilon=0.01, max_m=0.3, cls_num_list=[17, 23, 55])

loss_batch_bal = criteria_bal(scores, labels)
loss_batch_imbal = criteria_imbal(scores, labels)
```

### Smooth top-k function

We also provide a differentiable top-k function for tensors of any size that can be plugged into any neural network architecture:

```python
import torch
from pytopk import NoisedTopK

smooth_topk = NoisedTopK(k=3, dim=-1)
x = torch.tensor([[-1.5, 2.0, 0.7, 3.8],
                  [-1.1, -5.4, 0.1, 2.3]], requires_grad=True)
out = smooth_topk(x)
print(out)

>> tensor([ 0.4823, -1.4710], grad_fn=<_NoisedTopKBackward>)

out.sum().backward()
print(x.grad)

>> tensor([[0.0000, 0.4000, 0.6000, 0.0000],
          [0.8000, 0.0000, 0.2000, 0.0000]])
```
simplepysite 0.1.3
Simple static site generator
License: MIT

# Simplepysite

This is a super-simple static site generator. You can use it to write markdown files and quickly convert them to nicely-styled html. It is basically just some convenience functions built on top of the markdown library (required). This package will provide you with a very simple template for writing blog-like posts, as well as some simple css. Standard markdown syntax applies, and this is true for images and links.

## Install

Make sure you have activated your virtual environment and use pip:

```
python -m pip install simplepysite
```

## Usage
cd to the directory where you would like to create a site, and run the following:

```
python -m simplepysite
```

This will create a template site for you. The "pages" folder contains the markdown files, and html files will be created wherever this command is run.

If you are working this into a workflow, you can also import it as follows:

```python
from simplepysite.site import establish_site, build_site


establish_site() # creates a pages folder, a sample markdown file, and a generic style.css which can be edited

build_site() # assuming there is a "pages" folder, all markdown files contained therein are converted to html
```