semvec/pypi-packages huggingface dataset:
fdet-offline 1.0.5
An easy to use face detection module based on MTCNN and RetinaFace algorithms.
Requires Python: >=3.8
Keywords: face recognition detection biometry

# FDet-Offline: just like FDet, but offline

### Download like this: 
```console
pip install fdet-offline --find-links https://download.pytorch.org/whl/torch_stable.html
```

Package depends on torch-packages not in PyPi.

---

A version of [fdet](https://github.com/acnazarejr/fdet)
where you don't have to access the internet to download the weights.

These are the changes:

## MTCNN (only works for this model at the moment)
### 1.

In fdet/mtcnn.py, line 73-76, the url for the MTCNN-weights are listed:

```python
base_url = 'https://github.com/acnazarejr/fdet/releases/download/weights/'
self._pnet = self.__load_model(_PNet, base_url + 'mtcnn_pnet.pt')
self._rnet = self.__load_model(_RNet, base_url + 'mtcnn_rnet.pt')
self._onet = self.__load_model(_ONet, base_url + 'mtcnn_onet.pt')
```
I downloaded those weights and created packages to import them (because PyPi has a 100MB max on package size, this was the solution).

I put the weights in the directory **weights** in the package **fdet_offline_mtcnn_weights**.
The function **fdet_offline_mtcnn_weights.import_weights** takes *mtcnn_type* as input
and returns a partial function of [torch.load](https://pytorch.org/docs/stable/generated/torch.load.html#torch.load).

This partial function gets *map_location* from *__load_model*.

The previously mentioned fdet/mtcnn.py, line 73-76, now looks like this:

```python
self._pnet = self.__load_model(_PNet, 'pnet')
self._rnet = self.__load_model(_RNet, 'rnet')
self._onet = self.__load_model(_ONet, 'onet')
```

In fdet/mtcnn.py, what previously was (url was input):

```python

def __load_model(self, net_class: type, url: str) -> torch.nn.Module:
    """Download and construct the models"""
    try:
        state_dict = load_state_dict_from_url(url, map_location=self._device_control)
```

is now (mtcnn_type is input):


```python
def __load_model(self, net_class: type, mtcnn_type: str) -> torch.nn.Module:
    """Download and construct the models"""
    try:
        load_state_dict = import_weights.load_partial(mtcnn_type)
        state_dict = load_state_dict(map_location=self._device_control)
```


### 2.

At fdet/mtcnn.py, line 427:

```python
state_dict = load_state_dict_from_url(url, map_location=self._device_control)
```

[load_state_dict_from_url](https://pytorch.org/docs/stable/_modules/torch/hub.html#load_state_dict_from_url), returns a [torch.load](https://pytorch.org/docs/stable/generated/torch.load.html#torch.load) which takes the weight-file as input.
I replaced the load_state_dict_from_url with torch.load, and that's it. 

That line now states this instead;

```python
state_dict = torch.load(url, map_location=self._device_control)
```
digwebs 0.0.1
A tiny web framework-digwebs
Requires Python: >=3.6

# Digolds web framework

A tiny web framework called **digwebs** which is developed by Python. You can checkout the detail design of **digwebs** in [here](https://www.digolds.cn/detail/0015370868460626a029ac2cf3c42359d4e9fffeae137c7000). You can't use `pip` to install this web framework from PyPI right now, because digwebs is under development and is used to empower the web app called [digolds](https://www.digolds.cn). When more features are added to this framework, we will provide stable package to PyPI where you can use `pip` to install it to your computer.

As a developer, you can also use `git` to `pull` this repository to your computer, then follow below steps to quickly boost this framework.

1. Install Python 3.6.x to your computer
2. Use `git` to pull the source
3. Run `pip install jinja2` to install jinja2 to your computer
4. Run `python .\digwebs\project_generator.py` to generate the project file structure

This step will generate project layout like below:
```
.
  |-controllers
  |-digwebs
  |-middlewares
  |-static
  |  |-css
  |  |-fonts
  |  |-images
  |  |-js
  |-test
  |-views
```

* **digwebs** is where this web framework locate
* **controllers** is where you put controller script
* **middlewares** is where you put middlewares script
* **static** is where you put front end script such as css file, javascript file, font, image etc
* **test** is where you put the test script for your web app
* **views** is where you put the html file

5. run `python .\digwebs.py` to launch the web app demo
6. open your browser and enter `localhost:9999`,you see the content `"digwebs - A Minimal Web Framework!"`

**Note**: if you want to be a master of `digwebs`, head over [here](https://www.digolds.cn/article/00153708688234475cbc5a7d7994e8ebc8b8df6d33a12a1000) to learn the design philosophy of `digwebs`

# Contribution

We are looking for contributors. Please check open issues in the above repos if you think you could help, or open a new one if you have an idea you'd like to discuss.

# License

This project is licensed under the MIT open source license.