dolg


Namedolg JSON
Version 0.1.5.1 PyPI version JSON
download
home_pagehttps://github.com/Shiro-LK/python-DOLG
SummaryRe-implementation of DOLG paper in torch and tensorflow with converted checkpoints
upload_time2023-01-02 23:46:56
maintainer
docs_urlNone
authorShiro-LK
requires_python
licenseMIT License
keywords dolg for torch and tensorflow pretrained weights tensorflow tf pytorch torch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DOLG in torch and tensorflow (TF2)

Re-implementation (Non Official) of the paper DOLG: Single-Stage Image Retrieval with Deep Orthogonal Fusion of Local and Global Features accepted at ICCV 2021.
[paper](https://arxiv.org/pdf/2108.02927.pdf)

The pytorch checkpoint has been converted into tensorflow format (.h5) from this repository : https://github.com/feymanpriv/DOLG (Official) 

## Pipeline

![Image](images/dolg.png)

## Installation 

> pip install opencv-python==4.5.5.64

> pip install huggingface-hub

to install dolg : 

> pip install dolg
OR 
> pip install -e .

## Inference

To do some inference on single sample, you can use python script in examples/ folder or use as follows:

```
import dolg
import numpy as np
from dolg.utils.extraction import process_data

depth = 50

# for pytorch

import torch
from dolg.dolg_model_pt import DOLG
from dolg.resnet_pt import ResNet

backbone = ResNet(depth=depth, num_groups=1, width_per_group=64, bn_eps=1e-5, 
             bn_mom=0.1, trans_fun="bottleneck_transform")
model = DOLG(backbone, s4_dim=2048, s3_dim=1024, s2_dim=512, head_reduction_dim=512,
             with_ma=False, num_classes=None, pretrained=f"r{depth}")
img = process_data("image.jpg", "", mode="pt").unsqueeze(0)

with torch.no_grad():
    output = model(img)
print(output)

# for tensorflow

import tensorflow as tf
from dolg.dolg_model_tf2 import DOLG
from dolg.resnet_tf2 import ResNet


backbone = ResNet(depth=depth, num_groups=1, width_per_group=64, bn_eps=1e-5, 
             bn_mom=0.1, trans_fun="bottleneck_transform", name="globalmodel")
model = DOLG(backbone, s4_dim=2048, s3_dim=1024, s2_dim=512, head_reduction_dim=512,
             with_ma=False, num_classes=None, pretrained=f"r{depth}")
img = process_data("image.jpg", "", mode="tf")
img = np.expand_dims(img, axis=0)
output = model.predict(img)
print(output)
```

## Data 

The model has been trained on google landmark v2. You can find the dataset on the official repository : https://github.com/cvdfoundation/google-landmark .


# Citation : 

```bibtex

@misc{yang2021dolg,
      title={DOLG: Single-Stage Image Retrieval with Deep Orthogonal Fusion of Local and Global Features}, 
      author={Min Yang and Dongliang He and Miao Fan and Baorong Shi and Xuetong Xue and Fu Li and Errui Ding and Jizhou Huang},
      year={2021},
      eprint={2108.02927},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}


@misc{https://doi.org/10.48550/arxiv.2004.01804,
  doi = {10.48550/ARXIV.2004.01804},

  url = {https://arxiv.org/abs/2004.01804},

  author = {Weyand, Tobias and Araujo, Andre and Cao, Bingyi and Sim, Jack},

  keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},

  title = {Google Landmarks Dataset v2 -- A Large-Scale Benchmark for Instance-Level Recognition and Retrieval},
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Shiro-LK/python-DOLG",
    "name": "dolg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "DOLG for torch and tensorflow,pretrained weights,tensorflow,tf,pytorch,torch",
    "author": "Shiro-LK",
    "author_email": "shirosaki94@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/80/7ee6e1fa67130ac85949e1eab15e9bc4ebeb720c8f3d504f2fad97a3161e/dolg-0.1.5.1.tar.gz",
    "platform": null,
    "description": "# DOLG in torch and tensorflow (TF2)\n\nRe-implementation (Non Official) of the paper DOLG: Single-Stage Image Retrieval with Deep Orthogonal Fusion of Local and Global Features accepted at ICCV 2021.\n[paper](https://arxiv.org/pdf/2108.02927.pdf)\n\nThe pytorch checkpoint has been converted into tensorflow format (.h5) from this repository : https://github.com/feymanpriv/DOLG (Official) \n\n## Pipeline\n\n![Image](images/dolg.png)\n\n## Installation \n\n> pip install opencv-python==4.5.5.64\n\n> pip install huggingface-hub\n\nto install dolg : \n\n> pip install dolg\nOR \n> pip install -e .\n\n## Inference\n\nTo do some inference on single sample, you can use python script in examples/ folder or use as follows:\n\n```\nimport dolg\nimport numpy as np\nfrom dolg.utils.extraction import process_data\n\ndepth = 50\n\n# for pytorch\n\nimport torch\nfrom dolg.dolg_model_pt import DOLG\nfrom dolg.resnet_pt import ResNet\n\nbackbone = ResNet(depth=depth, num_groups=1, width_per_group=64, bn_eps=1e-5, \n             bn_mom=0.1, trans_fun=\"bottleneck_transform\")\nmodel = DOLG(backbone, s4_dim=2048, s3_dim=1024, s2_dim=512, head_reduction_dim=512,\n             with_ma=False, num_classes=None, pretrained=f\"r{depth}\")\nimg = process_data(\"image.jpg\", \"\", mode=\"pt\").unsqueeze(0)\n\nwith torch.no_grad():\n    output = model(img)\nprint(output)\n\n# for tensorflow\n\nimport tensorflow as tf\nfrom dolg.dolg_model_tf2 import DOLG\nfrom dolg.resnet_tf2 import ResNet\n\n\nbackbone = ResNet(depth=depth, num_groups=1, width_per_group=64, bn_eps=1e-5, \n             bn_mom=0.1, trans_fun=\"bottleneck_transform\", name=\"globalmodel\")\nmodel = DOLG(backbone, s4_dim=2048, s3_dim=1024, s2_dim=512, head_reduction_dim=512,\n             with_ma=False, num_classes=None, pretrained=f\"r{depth}\")\nimg = process_data(\"image.jpg\", \"\", mode=\"tf\")\nimg = np.expand_dims(img, axis=0)\noutput = model.predict(img)\nprint(output)\n```\n\n## Data \n\nThe model has been trained on google landmark v2. You can find the dataset on the official repository : https://github.com/cvdfoundation/google-landmark .\n\n\n# Citation : \n\n```bibtex\n\n@misc{yang2021dolg,\n      title={DOLG: Single-Stage Image Retrieval with Deep Orthogonal Fusion of Local and Global Features}, \n      author={Min Yang and Dongliang He and Miao Fan and Baorong Shi and Xuetong Xue and Fu Li and Errui Ding and Jizhou Huang},\n      year={2021},\n      eprint={2108.02927},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV}\n}\n\n\n@misc{https://doi.org/10.48550/arxiv.2004.01804,\n  doi = {10.48550/ARXIV.2004.01804},\n\n  url = {https://arxiv.org/abs/2004.01804},\n\n  author = {Weyand, Tobias and Araujo, Andre and Cao, Bingyi and Sim, Jack},\n\n  keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},\n\n  title = {Google Landmarks Dataset v2 -- A Large-Scale Benchmark for Instance-Level Recognition and Retrieval},\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Re-implementation of DOLG paper in torch and tensorflow with converted checkpoints",
    "version": "0.1.5.1",
    "split_keywords": [
        "dolg for torch and tensorflow",
        "pretrained weights",
        "tensorflow",
        "tf",
        "pytorch",
        "torch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "816d3a3ed16afda47e2b3869dfbf4f1e7dfb9fc9975577d08a26528d38923de6",
                "md5": "b9e6fba410e1111c4247d4c12f311e4b",
                "sha256": "588e31d5a1f3e34db456ef8aa98a858e60ed3609d0b9d29966b2c10b79095b27"
            },
            "downloads": -1,
            "filename": "dolg-0.1.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9e6fba410e1111c4247d4c12f311e4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18540,
            "upload_time": "2023-01-02T23:46:45",
            "upload_time_iso_8601": "2023-01-02T23:46:45.248032Z",
            "url": "https://files.pythonhosted.org/packages/81/6d/3a3ed16afda47e2b3869dfbf4f1e7dfb9fc9975577d08a26528d38923de6/dolg-0.1.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a807ee6e1fa67130ac85949e1eab15e9bc4ebeb720c8f3d504f2fad97a3161e",
                "md5": "cc4ee89a6d2ee64443df5ca12ab29fdb",
                "sha256": "2cc4c6475479521c54853a55bedeb3da1437e6854def103a6fe58aca16471bd9"
            },
            "downloads": -1,
            "filename": "dolg-0.1.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cc4ee89a6d2ee64443df5ca12ab29fdb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15116,
            "upload_time": "2023-01-02T23:46:56",
            "upload_time_iso_8601": "2023-01-02T23:46:56.066860Z",
            "url": "https://files.pythonhosted.org/packages/2a/80/7ee6e1fa67130ac85949e1eab15e9bc4ebeb720c8f3d504f2fad97a3161e/dolg-0.1.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-02 23:46:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Shiro-LK",
    "github_project": "python-DOLG",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dolg"
}
        
Elapsed time: 0.02337s