Skip to content

Commit 6932968

Browse files
Merge pull request #1 from Clarifai/DEVX-125-Annotation_conversion
[DEVX-125]: Annotation Conversion
2 parents fa0d6fd + f8e40d5 commit 6932968

File tree

137 files changed

+2725
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2725
-1
lines changed

.gitignore

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
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+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Editor Directories
105+
.idea
106+
*.swp
107+
.vscode
108+
109+
# Environments
110+
.env
111+
.venv
112+
env/
113+
venv/
114+
ENV/
115+
env.bak/
116+
venv.bak/
117+
118+
# Spyder project settings
119+
.spyderproject
120+
.spyproject
121+
122+
# Rope project settings
123+
.ropeproject
124+
125+
# mkdocs documentation
126+
/site
127+
128+
# mypy
129+
.mypy_cache/
130+
.dmypy.json
131+
dmypy.json
132+
133+
# Pyre type checker
134+
.pyre/
135+
136+
# macOS specific files
137+
.DS_Store

.isort.cfg

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[settings]
2+
line_length=99
3+
4+
# Ignore differences in whitespace.
5+
ignore_whitespace=True
6+
7+
known_third_party=
8+
grpc,
9+
yaml,
10+
cached_property,
11+
lap,
12+
magic,
13+
PIL,
14+
pydub,
15+
google,
16+
mock,
17+
requests,
18+
googleapiclient,
19+
oauth2client,
20+
dns,
21+
noise,
22+
urllib3,
23+
simplejson,
24+
imageio,
25+
retrying,
26+
json_lines
27+
28+
29+
# isort being dumb
30+
known_future_library=
31+
future,
32+
six,
33+
past

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
default_stages:
2+
- commit
3+
- manual
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-executables-have-shebangs
10+
- id: check-case-conflict
11+
- id: check-merge-conflict
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
- repo: https://github.com/timothycrosley/isort
16+
rev: 5.12.0
17+
hooks:
18+
- id: isort
19+
- repo: https://github.com/charliermarsh/ruff-pre-commit
20+
rev: v0.0.292
21+
hooks:
22+
- id: ruff
23+
args: [--fix, --exit-non-zero-on-fix]
24+
- repo: local
25+
hooks:
26+
- id: yapf
27+
name: yapf
28+
entry: yapf -i
29+
language: python
30+
types: [ python ]
31+
pass_filenames: true
32+
additional_dependencies: [ "yapf==0.19.0" ]

.ruff.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
2+
select = ["E4", "E7", "E9", "F"]
3+
ignore = ["E501"]
4+
5+
# Allow fix for all enabled rules (when `--fix`) is provided.
6+
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
7+
unfixable = []
8+
9+
# Exclude a variety of commonly ignored directories.
10+
exclude = [
11+
".bzr",
12+
".direnv",
13+
".eggs",
14+
".git",
15+
".git-rewrite",
16+
".hg",
17+
".mypy_cache",
18+
".nox",
19+
".pants.d",
20+
".pytype",
21+
".ruff_cache",
22+
".svn",
23+
".tox",
24+
".venv",
25+
"__pypackages__",
26+
"_build",
27+
"buck-out",
28+
"build",
29+
"dist",
30+
"node_modules",
31+
"venv",
32+
]
33+
34+
# Same as Black.
35+
line-length = 88
36+
37+
# Allow unused variables when underscore-prefixed.
38+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
39+
40+
target-version = "py39"

.style.yapf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[style]
2+
based_on_style = google
3+
4+
# maximum number of chars per line
5+
column_limit = 99
6+
7+
# number of spaces for a block indent
8+
indent_width = 2
9+
10+
# number of spaces for line continuation indent
11+
# (i.e. single statement spanning more than one line)
12+
continuation_indent_width = 4
13+
14+
# number of spaces between the end of a statement and same-line comment, e.g.:
15+
# x = 3 # there are 2 spaces before this comment
16+
spaces_before_comment = 2
17+
18+
# prefer to put long class lists in "from module import (...)" statements
19+
# on fewer lines, not one class per line
20+
split_penalty_import_names = 0
21+
22+
# prefer a little more to keep function calls on the same line as
23+
# their first argument. increased from default value 30
24+
split_penalty_after_opening_bracket = 70
25+
26+
# indent values relative to keys in multiline dict entries, e.g.:
27+
# {key_with_long_name:
28+
# value_on_a_long_line,
29+
# }
30+
indent_dictionary_value = true

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## [[0.0.1]](https://github.com/Clarifai/clarifai-python-datautils/releases/tag/0.0.1) - [PyPI](https://pypi.org/project/clarifai-datautils/0.0.1/) - 2024-01-23

README.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,84 @@
1-
# clarifai-python-datautils
1+
![Clarifai logo](docs/logo.png)
2+
3+
# Clarifai Python Data Utils
4+
5+
6+
[![Discord](https://img.shields.io/discord/1145701543228735582)](https://discord.gg/M32V7a7a)
7+
[![codecov](https://img.shields.io/pypi/dm/clarifai)](https://pypi.org/project/clarifai)
8+
9+
This is a collection of utilities for handling various types of multimedia data. Enhance your experience by seamlessly integrating these utilities with the Clarifai Python SDK. This powerful combination empowers you to address both visual and textual use cases effortlessly through the capabilities of Artificial Intelligence. Unlock new possibilities and elevate your projects with the synergy of versatile data utilities and the robust features offered by the [Clarifai Python SDK](https://github.com/Clarifai/clarifai-python). Explore the fusion of these tools to amplify the intelligence in your applications! 🌐🚀
10+
11+
[Website](https://www.clarifai.com/) | [Schedule Demo](https://www.clarifai.com/company/schedule-demo) | [Signup for a Free Account](https://clarifai.com/signup) | [API Docs](https://docs.clarifai.com/) | [Clarifai Community](https://clarifai.com/explore) | [Python SDK Docs](https://docs.clarifai.com/python-sdk/api-reference) | [Examples](https://github.com/Clarifai/examples) | [Colab Notebooks](https://github.com/Clarifai/colab-notebooks) | [Discord](https://discord.gg/XAPE3Vtg)
12+
13+
---
14+
## Table Of Contents
15+
16+
* **[Installation](#installation)**
17+
* **[Getting Started](#getting-started)**
18+
* **[Features](#features)**
19+
* [Image Utils](#image-utils)
20+
* **[Usage](#usage)**
21+
* **[Examples](#more-examples)**
22+
23+
24+
## Installation
25+
26+
27+
Install from PyPi:
28+
29+
```bash
30+
pip install clarifai-datautils
31+
```
32+
33+
Install from Source:
34+
35+
```bash
36+
git clone https://github.com/Clarifai/clarifai-python-datautils
37+
cd clarifai-python-datautils
38+
python3 -m venv env
39+
source env/bin/activate
40+
pip3 install -r requirements.txt
41+
```
42+
43+
44+
## Getting started
45+
46+
Quick intro to Image Annotation Conversion feature
47+
48+
```python
49+
from clarifai_datautils import ImageAnnotations
50+
51+
annotated_dataset = ImageAnnotations.import_from(path= 'folder_path', format= 'annotation_format')
52+
```
53+
54+
## Features
55+
56+
### Image Utils
57+
- #### Annotation Loader
58+
- Load various annotated image datasets and export to clarifai Platform
59+
- Convert from one annotation format to other supported annotation formats
60+
61+
62+
63+
## Usage
64+
### Image Annotation Loader
65+
```python
66+
from clarifai_datautils import ImageAnnotations
67+
#import from folder
68+
coco_dataset = ImageAnnotations.import_from(path='folder_path',format= 'coco_detection')
69+
70+
#clarifai dataset loader object
71+
coco_dataset.dataloader
72+
73+
74+
#info about loaded dataset
75+
coco_dataset.get_info()
76+
77+
78+
#exporting to other formats
79+
coco_dataset.export_to('voc_detection')
80+
```
81+
82+
## More Examples
83+
84+
See many more code examples in this [repo](https://github.com/Clarifai/examples).

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

clarifai_datautils/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from clarifai_datautils.image.annotation_conversion.annotations import ImageAnnotations
2+
3+
__all__ = ['ImageAnnotations']

0 commit comments

Comments
 (0)