imagenet-classes 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imagenet_classes-0.1.1/.gitignore +180 -0
- imagenet_classes-0.1.1/LICENSE +21 -0
- imagenet_classes-0.1.1/MANIFEST.in +19 -0
- imagenet_classes-0.1.1/PKG-INFO +90 -0
- imagenet_classes-0.1.1/README.md +46 -0
- imagenet_classes-0.1.1/class_mapping/__init__.py +13 -0
- imagenet_classes-0.1.1/class_mapping/class_loader.py +187 -0
- imagenet_classes-0.1.1/class_mapping/cls_name_mod.npy +0 -0
- imagenet_classes-0.1.1/class_mapping/imagenet2012_classes.npy +0 -0
- imagenet_classes-0.1.1/class_mapping/imagenet21k_classes.npy +0 -0
- imagenet_classes-0.1.1/class_mapping/imagenet21k_classes_r.npy +0 -0
- imagenet_classes-0.1.1/class_mapping/val_img_classes_pairs.npy +0 -0
- imagenet_classes-0.1.1/examples/basic_usage.py +59 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/PKG-INFO +90 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/SOURCES.txt +21 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/dependency_links.txt +1 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/not-zip-safe +1 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/requires.txt +8 -0
- imagenet_classes-0.1.1/imagenet_classes.egg-info/top_level.txt +1 -0
- imagenet_classes-0.1.1/pyproject.toml +121 -0
- imagenet_classes-0.1.1/requirements.txt +1 -0
- imagenet_classes-0.1.1/setup.cfg +4 -0
- imagenet_classes-0.1.1/setup.py +72 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fm/#using-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
|
|
158
|
+
# project, it is recommended to include the following files:
|
|
159
|
+
# .idea/
|
|
160
|
+
# *.iml
|
|
161
|
+
# *.ipr
|
|
162
|
+
# *.iws
|
|
163
|
+
|
|
164
|
+
# VS Code
|
|
165
|
+
.vscode/
|
|
166
|
+
|
|
167
|
+
# macOS
|
|
168
|
+
.DS_Store
|
|
169
|
+
|
|
170
|
+
# Windows
|
|
171
|
+
Thumbs.db
|
|
172
|
+
ehthumbs.db
|
|
173
|
+
Desktop.ini
|
|
174
|
+
|
|
175
|
+
# Linux
|
|
176
|
+
*~
|
|
177
|
+
.fuse_hidden*
|
|
178
|
+
.directory
|
|
179
|
+
.Trash-*
|
|
180
|
+
.nfs*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Illia Volkov, Nikita Kisel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include requirements.txt
|
|
4
|
+
include pyproject.toml
|
|
5
|
+
include setup.py
|
|
6
|
+
|
|
7
|
+
recursive-include class_mapping *.npy
|
|
8
|
+
recursive-include class_mapping *.py
|
|
9
|
+
|
|
10
|
+
recursive-exclude * __pycache__
|
|
11
|
+
recursive-exclude * *.py[co]
|
|
12
|
+
recursive-exclude * .DS_Store
|
|
13
|
+
recursive-exclude * .git*
|
|
14
|
+
recursive-exclude * .pytest_cache
|
|
15
|
+
recursive-exclude * .coverage
|
|
16
|
+
recursive-exclude * htmlcov
|
|
17
|
+
recursive-exclude * dist
|
|
18
|
+
recursive-exclude * build
|
|
19
|
+
recursive-exclude * *.egg-info
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: imagenet-classes
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python package for managing and retrieving ImageNet-1k mappings among integer class IDs, string class IDs, and human-readable class names.
|
|
5
|
+
Home-page: https://github.com/gonikisgo/imagenet-classes
|
|
6
|
+
Author: Illia Volkov, Nikita Kisel
|
|
7
|
+
Author-email: Illia Volkov <volkoill@cvut.cz>, Nikita Kisel <kiselnik@fel.cvut.cz>
|
|
8
|
+
Maintainer-email: Nikita Kisel <kiselnik@fel.cvut.cz>
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Homepage, https://github.com/gonikisgo/imagenet-classes
|
|
11
|
+
Project-URL: Documentation, https://github.com/gonikisgo/imagenet-classes#readme
|
|
12
|
+
Project-URL: Repository, https://github.com/gonikisgo/imagenet-classes
|
|
13
|
+
Project-URL: Bug Tracker, https://github.com/gonikisgo/imagenet-classes/issues
|
|
14
|
+
Keywords: imagenet,computer-vision,machine-learning,deep-learning,classification
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Classifier: Framework :: Pytest
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Requires-Dist: numpy>=1.19.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=3.8; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=0.800; extra == "dev"
|
|
40
|
+
Dynamic: author
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: requires-python
|
|
44
|
+
|
|
45
|
+
# ImageNet Classes
|
|
46
|
+
|
|
47
|
+
A Python package for managing and retrieving ImageNet-1k (ImageNet2012) class names and mappings.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### From PyPI (when published)
|
|
52
|
+
```bash
|
|
53
|
+
pip install imagenet-classes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### From Source
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/gonikisgo/imagenet-classes.git
|
|
59
|
+
cd imagenet-classes
|
|
60
|
+
pip install -e .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from class_mapping import ClassDictionary
|
|
67
|
+
|
|
68
|
+
# Initialize the class dictionary
|
|
69
|
+
class_dict = ClassDictionary()
|
|
70
|
+
|
|
71
|
+
# Get class name for ImageNet-1k class index 0
|
|
72
|
+
class_name = class_dict.get_class_name(0)
|
|
73
|
+
print(f"Class 0: {class_name}")
|
|
74
|
+
|
|
75
|
+
# Get ImageNet21k to ImageNet-1k class mapping
|
|
76
|
+
class_1k = class_dict.get_class_1k("n01440764")
|
|
77
|
+
print(f"Class 1k mapping: {class_1k}")
|
|
78
|
+
|
|
79
|
+
# Get custom class name
|
|
80
|
+
custom_name = class_dict.get_custom_class_name(0)
|
|
81
|
+
print(f"Custom name: {custom_name}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
87
|
+
|
|
88
|
+
## Support
|
|
89
|
+
|
|
90
|
+
For support, please open an issue on the [GitHub repository](https://github.com/gonikisgo/imagenet-classes/issues).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ImageNet Classes
|
|
2
|
+
|
|
3
|
+
A Python package for managing and retrieving ImageNet-1k (ImageNet2012) class names and mappings.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### From PyPI (when published)
|
|
8
|
+
```bash
|
|
9
|
+
pip install imagenet-classes
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### From Source
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/gonikisgo/imagenet-classes.git
|
|
15
|
+
cd imagenet-classes
|
|
16
|
+
pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from class_mapping import ClassDictionary
|
|
23
|
+
|
|
24
|
+
# Initialize the class dictionary
|
|
25
|
+
class_dict = ClassDictionary()
|
|
26
|
+
|
|
27
|
+
# Get class name for ImageNet-1k class index 0
|
|
28
|
+
class_name = class_dict.get_class_name(0)
|
|
29
|
+
print(f"Class 0: {class_name}")
|
|
30
|
+
|
|
31
|
+
# Get ImageNet21k to ImageNet-1k class mapping
|
|
32
|
+
class_1k = class_dict.get_class_1k("n01440764")
|
|
33
|
+
print(f"Class 1k mapping: {class_1k}")
|
|
34
|
+
|
|
35
|
+
# Get custom class name
|
|
36
|
+
custom_name = class_dict.get_custom_class_name(0)
|
|
37
|
+
print(f"Custom name: {custom_name}")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
43
|
+
|
|
44
|
+
## Support
|
|
45
|
+
|
|
46
|
+
For support, please open an issue on the [GitHub repository](https://github.com/gonikisgo/imagenet-classes/issues).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ImageNet Classes Package
|
|
3
|
+
|
|
4
|
+
A Python package for managing and retrieving ImageNet-1k mappings among integer class IDs, string class IDs, and human-readable class names.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .class_loader import ClassDictionary
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.1"
|
|
10
|
+
__author__ = "Illia Volkov, Nikita Kisel"
|
|
11
|
+
__email__ = "kiselnik@fel.cvut.cz"
|
|
12
|
+
|
|
13
|
+
__all__ = ["ClassDictionary"]
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ClassDictionary:
|
|
7
|
+
"""
|
|
8
|
+
Class to manage and retrieve class names from files containing ImageNet class data.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
filename (str): The path to the file containing class-name mapping for ImageNet2012.
|
|
12
|
+
filename_21k (str): The path to the file containing the class mapping from ImageNet21k to ImageNet2012.
|
|
13
|
+
class2name (dict): A dictionary to store the class data for ImageNet2012.
|
|
14
|
+
class2short_class (dict): A dictionary to store the class data for ImageNet21k.
|
|
15
|
+
"""
|
|
16
|
+
def __init__(self, filename = 'imagenet2012_classes.npy', custom_cls_filename='cls_name_mod.npy',
|
|
17
|
+
filename_21k = 'imagenet21k_classes.npy', filename_21k_r = 'imagenet21k_classes_r.npy',
|
|
18
|
+
filename_val_class = 'val_img_classes_pairs.npy'):
|
|
19
|
+
current_dir = os.path.dirname(__file__)
|
|
20
|
+
self.filename = os.path.join(current_dir, filename)
|
|
21
|
+
self.custom_cls_filename = os.path.join(current_dir, custom_cls_filename)
|
|
22
|
+
self.filename_21k = os.path.join(current_dir, filename_21k)
|
|
23
|
+
self.filename_21k_r = os.path.join(current_dir, filename_21k_r)
|
|
24
|
+
self.filename_val_class = os.path.join(current_dir, filename_val_class)
|
|
25
|
+
self.class2name = {}
|
|
26
|
+
self.class2custom_name = None
|
|
27
|
+
self.class2short_class = {}
|
|
28
|
+
self.class2short_class_r = {}
|
|
29
|
+
self.val2short_class = {}
|
|
30
|
+
self._data_loaded = False
|
|
31
|
+
self._custom_data_loaded = False
|
|
32
|
+
self._data_21k_loaded = False
|
|
33
|
+
self._data_21k_r_loaded = False
|
|
34
|
+
self._val_class_loaded = False
|
|
35
|
+
|
|
36
|
+
def __load_class2name_mapping(self):
|
|
37
|
+
"""Loads class data from the file into the class2name dictionary."""
|
|
38
|
+
try:
|
|
39
|
+
self.class2name = np.load(self.filename, allow_pickle=True).item()
|
|
40
|
+
self._data_loaded = True
|
|
41
|
+
except FileNotFoundError:
|
|
42
|
+
print(f"Error: The file '{self.filename}' was not found.")
|
|
43
|
+
self._data_loaded = False
|
|
44
|
+
except ValueError:
|
|
45
|
+
print(f"Error: The file '{self.filename}' contains invalid data.")
|
|
46
|
+
self._data_loaded = False
|
|
47
|
+
except Exception as e:
|
|
48
|
+
print(f"An unexpected error occurred: {e}")
|
|
49
|
+
self._data_loaded = False
|
|
50
|
+
|
|
51
|
+
def __load_class2custom_name_mapping(self):
|
|
52
|
+
"""Loads class data from the file into the class2custom_name dictionary."""
|
|
53
|
+
try:
|
|
54
|
+
self.class2custom_name = np.load(self.custom_cls_filename)
|
|
55
|
+
self._custom_data_loaded = True
|
|
56
|
+
except FileNotFoundError:
|
|
57
|
+
print(f"Error: The file '{self.custom_cls_filename}' was not found.")
|
|
58
|
+
self._data_loaded = False
|
|
59
|
+
except ValueError:
|
|
60
|
+
print(f"Error: The file '{self.custom_cls_filename}' contains invalid data.")
|
|
61
|
+
self._data_loaded = False
|
|
62
|
+
except Exception as e:
|
|
63
|
+
print(f"An unexpected error occurred: {e}")
|
|
64
|
+
self._custom_data_loaded = False
|
|
65
|
+
|
|
66
|
+
def __load_class2short_class_mapping(self):
|
|
67
|
+
"""Loads class data from the file into the class2short_class dictionary."""
|
|
68
|
+
try:
|
|
69
|
+
self.class2short_class = np.load(self.filename_21k, allow_pickle=True).item()
|
|
70
|
+
self._data_21k_loaded = True
|
|
71
|
+
except FileNotFoundError:
|
|
72
|
+
print(f"Error: The file '{self.filename_21k}' was not found.")
|
|
73
|
+
self._data_21k_loaded = False
|
|
74
|
+
except ValueError:
|
|
75
|
+
print(f"Error: The file '{self.filename_21k}' contains invalid data.")
|
|
76
|
+
self._data_21k_loaded = False
|
|
77
|
+
except Exception as e:
|
|
78
|
+
print(f"An unexpected error occurred: {e}")
|
|
79
|
+
self._data_21k_loaded = False
|
|
80
|
+
|
|
81
|
+
def __load_class2short_class_r_mapping(self):
|
|
82
|
+
"""Loads numeric class data from the file into the class2short_class dictionary."""
|
|
83
|
+
try:
|
|
84
|
+
self.class2short_class_r = np.load(self.filename_21k_r, allow_pickle=True).item()
|
|
85
|
+
self._data_21k_r_loaded = True
|
|
86
|
+
except FileNotFoundError:
|
|
87
|
+
print(f"Error: The file '{self.filename_21k_r}' was not found.")
|
|
88
|
+
self._data_21k_r_loaded = False
|
|
89
|
+
except ValueError:
|
|
90
|
+
print(f"Error: The file '{self.filename_21k_r}' contains invalid data.")
|
|
91
|
+
self._data_21k_r_loaded = False
|
|
92
|
+
except Exception as e:
|
|
93
|
+
print(f"An unexpected error occurred: {e}")
|
|
94
|
+
self._data_21k_r_loaded = False
|
|
95
|
+
|
|
96
|
+
def __load_val2short_class_mapping(self):
|
|
97
|
+
"""Loads validation images data from the file into the val2short_class dictionary."""
|
|
98
|
+
try:
|
|
99
|
+
self.val2short_class = np.load(self.filename_val_class, allow_pickle=True).item()
|
|
100
|
+
self._val_class_loaded = True
|
|
101
|
+
except FileNotFoundError:
|
|
102
|
+
print(f"Error: The file '{self.filename_val_class}' was not found.")
|
|
103
|
+
self._val_class_loaded = False
|
|
104
|
+
except ValueError:
|
|
105
|
+
print(f"Error: The file '{self.filename_val_class}' contains invalid data.")
|
|
106
|
+
self._val_class_loaded = False
|
|
107
|
+
except Exception as e:
|
|
108
|
+
print(f"An unexpected error occurred: {e}")
|
|
109
|
+
self._val_class_loaded = False
|
|
110
|
+
|
|
111
|
+
def get_class_name(self, key):
|
|
112
|
+
"""
|
|
113
|
+
Retrieves the class names associated with a given key.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
key (int): The key for which to retrieve class names.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
list[str] | None: A list of class names if the key exists, None otherwise.
|
|
120
|
+
"""
|
|
121
|
+
if not self._data_loaded:
|
|
122
|
+
self.__load_class2name_mapping()
|
|
123
|
+
return self.class2name.get(key)
|
|
124
|
+
|
|
125
|
+
def get_custom_class_name(self, key):
|
|
126
|
+
"""
|
|
127
|
+
Retrieves the custom class names associated with a given key.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
key (int): The key for which to retrieve class names.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
str | None: A class name if the key exists, None otherwise.
|
|
134
|
+
"""
|
|
135
|
+
if not self._custom_data_loaded:
|
|
136
|
+
self.__load_class2custom_name_mapping()
|
|
137
|
+
if self.class2custom_name is None:
|
|
138
|
+
return None
|
|
139
|
+
return self.class2custom_name[key]
|
|
140
|
+
|
|
141
|
+
def get_class_1k(self, key):
|
|
142
|
+
"""
|
|
143
|
+
Retrieves the class names associated with a given key from the ImageNet21k file.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
key (str): The key for which to perform mapping.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
int | None: class label in imagenet2012 if the key exists, None otherwise.
|
|
150
|
+
"""
|
|
151
|
+
if not self._data_21k_loaded:
|
|
152
|
+
self.__load_class2short_class_mapping()
|
|
153
|
+
return self.class2short_class.get(key)
|
|
154
|
+
|
|
155
|
+
def get_class_1k_r(self, key):
|
|
156
|
+
"""
|
|
157
|
+
Retrieves the numeric class names associated with a given key from the ImageNet21k file.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
key (int): The key for which to perform mapping.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
str | None: class label in imagenet21k if the key exists, None otherwise.
|
|
164
|
+
"""
|
|
165
|
+
if not self._data_21k_r_loaded:
|
|
166
|
+
self.__load_class2short_class_r_mapping()
|
|
167
|
+
return self.class2short_class_r.get(key)
|
|
168
|
+
|
|
169
|
+
def get_val_img_class(self, key):
|
|
170
|
+
"""
|
|
171
|
+
Retrieves the numeric class names associated with a given image key from the ImageNet21k file.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
key (str): The validation split image id.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
str | None: class label in imagenet21k if the key exists, None otherwise.
|
|
178
|
+
"""
|
|
179
|
+
if not self._val_class_loaded:
|
|
180
|
+
self.__load_val2short_class_mapping()
|
|
181
|
+
return self.val2short_class.get(key)
|
|
182
|
+
|
|
183
|
+
def create_cls_name_dict(self, class_names):
|
|
184
|
+
return {idx: cls for idx, cls in enumerate(class_names)}
|
|
185
|
+
|
|
186
|
+
def create_im_to_orig(self, class_list):
|
|
187
|
+
return {cls: idx for idx, cls in enumerate(class_list)}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Basic usage example for the imagenet-classes package.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from class_mapping import ClassDictionary
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
"""Demonstrate basic usage of the ClassDictionary class."""
|
|
11
|
+
|
|
12
|
+
print("ImageNet Classes Package - Basic Usage Example")
|
|
13
|
+
print("=" * 50)
|
|
14
|
+
|
|
15
|
+
# Initialize the class dictionary
|
|
16
|
+
print("Initializing ClassDictionary...")
|
|
17
|
+
class_dict = ClassDictionary()
|
|
18
|
+
|
|
19
|
+
# Demonstrate utility methods
|
|
20
|
+
print("\n1. Creating class name dictionaries:")
|
|
21
|
+
sample_classes = ['tench', 'goldfish', 'great_white_shark', 'tiger_shark', 'hammerhead']
|
|
22
|
+
|
|
23
|
+
# Create index to class name mapping
|
|
24
|
+
idx_to_name = class_dict.create_cls_name_dict(sample_classes)
|
|
25
|
+
print(f" Index to name: {idx_to_name}")
|
|
26
|
+
|
|
27
|
+
# Create class name to index mapping
|
|
28
|
+
name_to_idx = class_dict.create_im_to_orig(sample_classes)
|
|
29
|
+
print(f" Name to index: {name_to_idx}")
|
|
30
|
+
|
|
31
|
+
print("\n2. Accessing class data:")
|
|
32
|
+
print(" Note: Data files (.npy) need to be present for these methods to work")
|
|
33
|
+
|
|
34
|
+
# Try to get class names (will return None if files don't exist)
|
|
35
|
+
class_name = class_dict.get_class_name(0)
|
|
36
|
+
print(f" Class 0: {class_name}")
|
|
37
|
+
|
|
38
|
+
# Try to get custom class names
|
|
39
|
+
custom_name = class_dict.get_custom_class_name(0)
|
|
40
|
+
print(f" Custom class 0: {custom_name}")
|
|
41
|
+
|
|
42
|
+
# Try to get ImageNet21k mappings
|
|
43
|
+
class_1k = class_dict.get_class_1k("n01440764")
|
|
44
|
+
print(f" ImageNet21k mapping for n01440764: {class_1k}")
|
|
45
|
+
|
|
46
|
+
print("\n3. File paths:")
|
|
47
|
+
print(f" ImageNet2012 classes: {class_dict.filename}")
|
|
48
|
+
print(f" ImageNet21k classes: {class_dict.filename_21k}")
|
|
49
|
+
print(f" Custom classes: {class_dict.custom_cls_filename}")
|
|
50
|
+
|
|
51
|
+
print("\nExample completed successfully!")
|
|
52
|
+
print("\nTo use with actual data:")
|
|
53
|
+
print("1. Ensure the required .npy files are in the class_mapping directory")
|
|
54
|
+
print("2. The package will automatically load data when methods are called")
|
|
55
|
+
print("3. Data is loaded lazily for optimal memory usage")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
main()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: imagenet-classes
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python package for managing and retrieving ImageNet-1k mappings among integer class IDs, string class IDs, and human-readable class names.
|
|
5
|
+
Home-page: https://github.com/gonikisgo/imagenet-classes
|
|
6
|
+
Author: Illia Volkov, Nikita Kisel
|
|
7
|
+
Author-email: Illia Volkov <volkoill@cvut.cz>, Nikita Kisel <kiselnik@fel.cvut.cz>
|
|
8
|
+
Maintainer-email: Nikita Kisel <kiselnik@fel.cvut.cz>
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Homepage, https://github.com/gonikisgo/imagenet-classes
|
|
11
|
+
Project-URL: Documentation, https://github.com/gonikisgo/imagenet-classes#readme
|
|
12
|
+
Project-URL: Repository, https://github.com/gonikisgo/imagenet-classes
|
|
13
|
+
Project-URL: Bug Tracker, https://github.com/gonikisgo/imagenet-classes/issues
|
|
14
|
+
Keywords: imagenet,computer-vision,machine-learning,deep-learning,classification
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Classifier: Framework :: Pytest
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Requires-Dist: numpy>=1.19.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=3.8; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=0.800; extra == "dev"
|
|
40
|
+
Dynamic: author
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: requires-python
|
|
44
|
+
|
|
45
|
+
# ImageNet Classes
|
|
46
|
+
|
|
47
|
+
A Python package for managing and retrieving ImageNet-1k (ImageNet2012) class names and mappings.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### From PyPI (when published)
|
|
52
|
+
```bash
|
|
53
|
+
pip install imagenet-classes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### From Source
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/gonikisgo/imagenet-classes.git
|
|
59
|
+
cd imagenet-classes
|
|
60
|
+
pip install -e .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from class_mapping import ClassDictionary
|
|
67
|
+
|
|
68
|
+
# Initialize the class dictionary
|
|
69
|
+
class_dict = ClassDictionary()
|
|
70
|
+
|
|
71
|
+
# Get class name for ImageNet-1k class index 0
|
|
72
|
+
class_name = class_dict.get_class_name(0)
|
|
73
|
+
print(f"Class 0: {class_name}")
|
|
74
|
+
|
|
75
|
+
# Get ImageNet21k to ImageNet-1k class mapping
|
|
76
|
+
class_1k = class_dict.get_class_1k("n01440764")
|
|
77
|
+
print(f"Class 1k mapping: {class_1k}")
|
|
78
|
+
|
|
79
|
+
# Get custom class name
|
|
80
|
+
custom_name = class_dict.get_custom_class_name(0)
|
|
81
|
+
print(f"Custom name: {custom_name}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
87
|
+
|
|
88
|
+
## Support
|
|
89
|
+
|
|
90
|
+
For support, please open an issue on the [GitHub repository](https://github.com/gonikisgo/imagenet-classes/issues).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
LICENSE
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
requirements.txt
|
|
7
|
+
setup.py
|
|
8
|
+
class_mapping/__init__.py
|
|
9
|
+
class_mapping/class_loader.py
|
|
10
|
+
class_mapping/cls_name_mod.npy
|
|
11
|
+
class_mapping/imagenet2012_classes.npy
|
|
12
|
+
class_mapping/imagenet21k_classes.npy
|
|
13
|
+
class_mapping/imagenet21k_classes_r.npy
|
|
14
|
+
class_mapping/val_img_classes_pairs.npy
|
|
15
|
+
examples/basic_usage.py
|
|
16
|
+
imagenet_classes.egg-info/PKG-INFO
|
|
17
|
+
imagenet_classes.egg-info/SOURCES.txt
|
|
18
|
+
imagenet_classes.egg-info/dependency_links.txt
|
|
19
|
+
imagenet_classes.egg-info/not-zip-safe
|
|
20
|
+
imagenet_classes.egg-info/requires.txt
|
|
21
|
+
imagenet_classes.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class_mapping
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "imagenet-classes"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A Python package for managing and retrieving ImageNet-1k mappings among integer class IDs, string class IDs, and human-readable class names."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Illia Volkov", email = "volkoill@cvut.cz"},
|
|
13
|
+
{name = "Nikita Kisel", email = "kiselnik@fel.cvut.cz"}
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{name = "Nikita Kisel", email = "kiselnik@fel.cvut.cz"}
|
|
17
|
+
]
|
|
18
|
+
keywords = ["imagenet", "computer-vision", "machine-learning", "deep-learning", "classification"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: Science/Research",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.8",
|
|
27
|
+
"Programming Language :: Python :: 3.9",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Typing :: Typed",
|
|
32
|
+
"Framework :: Pytest",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
]
|
|
36
|
+
requires-python = ">=3.7"
|
|
37
|
+
dependencies = [
|
|
38
|
+
"numpy>=1.19.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=6.0",
|
|
44
|
+
"pytest-cov>=2.0",
|
|
45
|
+
"black>=21.0",
|
|
46
|
+
"flake8>=3.8",
|
|
47
|
+
"mypy>=0.800",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://github.com/gonikisgo/imagenet-classes"
|
|
52
|
+
Documentation = "https://github.com/gonikisgo/imagenet-classes#readme"
|
|
53
|
+
Repository = "https://github.com/gonikisgo/imagenet-classes"
|
|
54
|
+
"Bug Tracker" = "https://github.com/gonikisgo/imagenet-classes/issues"
|
|
55
|
+
|
|
56
|
+
[tool.setuptools]
|
|
57
|
+
packages = ["class_mapping"]
|
|
58
|
+
include-package-data = true
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
class_mapping = ["*.npy"]
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.dynamic]
|
|
64
|
+
version = {attr = "class_mapping.__version__"}
|
|
65
|
+
|
|
66
|
+
[tool.black]
|
|
67
|
+
line-length = 88
|
|
68
|
+
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
|
|
69
|
+
include = '\.pyi?$'
|
|
70
|
+
extend-exclude = '''
|
|
71
|
+
/(
|
|
72
|
+
# directories
|
|
73
|
+
\.eggs
|
|
74
|
+
| \.git
|
|
75
|
+
| \.hg
|
|
76
|
+
| \.mypy_cache
|
|
77
|
+
| \.tox
|
|
78
|
+
| \.venv
|
|
79
|
+
| build
|
|
80
|
+
| dist
|
|
81
|
+
)/
|
|
82
|
+
'''
|
|
83
|
+
|
|
84
|
+
[tool.pytest.ini_options]
|
|
85
|
+
testpaths = ["tests"]
|
|
86
|
+
python_files = ["test_*.py"]
|
|
87
|
+
python_classes = ["Test*"]
|
|
88
|
+
python_functions = ["test_*"]
|
|
89
|
+
addopts = [
|
|
90
|
+
"--strict-markers",
|
|
91
|
+
"--strict-config",
|
|
92
|
+
"--cov=class_mapping",
|
|
93
|
+
"--cov-report=term-missing",
|
|
94
|
+
"--cov-report=html",
|
|
95
|
+
]
|
|
96
|
+
markers = [
|
|
97
|
+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
98
|
+
"integration: marks tests as integration tests",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
[tool.coverage.run]
|
|
102
|
+
source = ["class_mapping"]
|
|
103
|
+
omit = [
|
|
104
|
+
"*/tests/*",
|
|
105
|
+
"*/test_*",
|
|
106
|
+
"*/__pycache__/*",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
[tool.coverage.report]
|
|
110
|
+
exclude_lines = [
|
|
111
|
+
"pragma: no cover",
|
|
112
|
+
"def __repr__",
|
|
113
|
+
"if self.debug:",
|
|
114
|
+
"if settings.DEBUG",
|
|
115
|
+
"raise AssertionError",
|
|
116
|
+
"raise NotImplementedError",
|
|
117
|
+
"if 0:",
|
|
118
|
+
"if __name__ == .__main__.:",
|
|
119
|
+
"class .*\\bProtocol\\):",
|
|
120
|
+
"@(abc\\.)?abstractmethod",
|
|
121
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
numpy>=1.19.0
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Setup script for the imagenet-classes package.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from setuptools import setup, find_packages
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
# Read the README file for long description
|
|
10
|
+
def read_readme():
|
|
11
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
12
|
+
return fh.read()
|
|
13
|
+
|
|
14
|
+
# Read requirements from requirements.txt if it exists
|
|
15
|
+
def read_requirements():
|
|
16
|
+
requirements = []
|
|
17
|
+
if os.path.exists("requirements.txt"):
|
|
18
|
+
with open("requirements.txt", "r", encoding="utf-8") as fh:
|
|
19
|
+
requirements = [line.strip() for line in fh if line.strip() and not line.startswith("#")]
|
|
20
|
+
return requirements
|
|
21
|
+
|
|
22
|
+
setup(
|
|
23
|
+
name="imagenet-classes",
|
|
24
|
+
author="Illia Volkov, Nikita Kisel",
|
|
25
|
+
author_email="kiselnik@fel.cvut.cz", # Primary contact
|
|
26
|
+
description="A Python package for managing and retrieving ImageNet-1k mappings among integer class IDs, string class IDs, and human-readable class names.",
|
|
27
|
+
long_description=read_readme(),
|
|
28
|
+
long_description_content_type="text/markdown",
|
|
29
|
+
url="https://github.com/gonikisgo/imagenet-classes",
|
|
30
|
+
packages=find_packages(),
|
|
31
|
+
classifiers=[
|
|
32
|
+
"Development Status :: 4 - Beta",
|
|
33
|
+
"Intended Audience :: Developers",
|
|
34
|
+
"Intended Audience :: Science/Research",
|
|
35
|
+
"License :: OSI Approved :: MIT License",
|
|
36
|
+
"Operating System :: OS Independent",
|
|
37
|
+
"Programming Language :: Python :: 3",
|
|
38
|
+
"Programming Language :: Python :: 3.7",
|
|
39
|
+
"Programming Language :: Python :: 3.8",
|
|
40
|
+
"Programming Language :: Python :: 3.9",
|
|
41
|
+
"Programming Language :: Python :: 3.10",
|
|
42
|
+
"Programming Language :: Python :: 3.11",
|
|
43
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
44
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
45
|
+
],
|
|
46
|
+
python_requires=">=3.8",
|
|
47
|
+
install_requires=[
|
|
48
|
+
"numpy>=1.19.0",
|
|
49
|
+
],
|
|
50
|
+
extras_require={
|
|
51
|
+
"dev": [
|
|
52
|
+
"pytest>=6.0",
|
|
53
|
+
"pytest-cov>=2.0",
|
|
54
|
+
"black>=21.0",
|
|
55
|
+
"flake8>=3.8",
|
|
56
|
+
"mypy>=0.800",
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
include_package_data=True,
|
|
60
|
+
package_data={
|
|
61
|
+
"class_mapping": [
|
|
62
|
+
"*.npy",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
zip_safe=False,
|
|
66
|
+
keywords="imagenet, computer-vision, machine-learning, deep-learning, classification",
|
|
67
|
+
project_urls={
|
|
68
|
+
"Bug Reports": "https://github.com/gonikisgo/imagenet-classes/issues",
|
|
69
|
+
"Source": "https://github.com/gonikisgo/imagenet-classes",
|
|
70
|
+
"Documentation": "https://github.com/gonikisgo/imagenet-classes#readme",
|
|
71
|
+
},
|
|
72
|
+
)
|