clarifai 10.1.0__py3-none-any.whl → 10.1.1__py3-none-any.whl

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.
@@ -1,19 +1,19 @@
1
1
  clarifai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  clarifai/errors.py,sha256=RwzTajwds51wLD0MVlMC5kcpBnzRpreDLlazPSBZxrg,2605
4
- clarifai/versions.py,sha256=rOO7lQPI_tpNMmnkH5-F2q_L7JJQ_Ee0JGsUM5jGZtA,186
4
+ clarifai/versions.py,sha256=bk6R6cGyCh8H_XRfcozmi8J8jsQ_tIACnIy4a-o0gbI,186
5
5
  clarifai/client/__init__.py,sha256=xI1U0l5AZdRThvQAXCLsd9axxyFzXXJ22m8LHqVjQRU,662
6
- clarifai/client/app.py,sha256=AWUngtwF6a0uS9DInf2arz5Aa-vbxt2Ce5WSNvwlAo0,26946
7
- clarifai/client/base.py,sha256=hv-eC0qAUMQlbAsSP_JgYfW0Z80C8_K5wo0bmMNoKQs,4963
8
- clarifai/client/dataset.py,sha256=Wq0dsRC8BfmS02NrMlnOyY2uaUYzzj3NALPjibfk-r8,23783
9
- clarifai/client/input.py,sha256=RDSGE2GdVqj31whRARFIpblm2_qbcbjW_SkvbUwTRio,38430
6
+ clarifai/client/app.py,sha256=_wDiHrMVhtofVHLZ2-4JHk_WoGCETPvHFe8ZQ3rRjFE,26700
7
+ clarifai/client/base.py,sha256=4XQU_cPyo8cCGUcZarCBXra_IVdT1KZGt_5c3OtdKig,6489
8
+ clarifai/client/dataset.py,sha256=hA7fmUcCPOE_Of1pYKqX_9e5pEdmTkODaZaC9adXMJ8,23820
9
+ clarifai/client/input.py,sha256=GZ7JWhS79GTQOqJ8KvexqLfWCyR-ANHACzciKE-wWxI,39769
10
10
  clarifai/client/lister.py,sha256=03KGMvs5RVyYqxLsSrWhNc34I8kiF1Ph0NeyEwu7nMU,2082
11
- clarifai/client/model.py,sha256=l2HP9qYuI8LpQRcj83f0HlSGTtbHQcUs3z6R-gLsyIg,24634
12
- clarifai/client/module.py,sha256=zO65sx7QAaziLIeqwWMR-rxrW9mcm2BZX8oXVyJx5WA,3781
13
- clarifai/client/runner.py,sha256=nP6QKs8Hy_52skr4gBNAfmPaTcYg20qzZDXnM2IxGlM,9679
14
- clarifai/client/search.py,sha256=pqX3BJmL8V1RKIGuNkbciDNYGoMwJj3k84B9OvpKl10,10555
15
- clarifai/client/user.py,sha256=6sOoHiBSHKz6zfEh4cjBbUe5CgmYs96RgHdcMmPoKys,9914
16
- clarifai/client/workflow.py,sha256=yOS9XwlO-zM6aHuM4aYGBHG1zYL0igXeZLJTkCcR3l4,9998
11
+ clarifai/client/model.py,sha256=NoCfJ9vU9NvhXBszEV1Bi0O9xkNVzjWmmP6SFi8ZG1g,32311
12
+ clarifai/client/module.py,sha256=BunlC4Uv7TX9JaZ0Kciwy_1_Mtg2GPZV5OLLZZcGz6I,3977
13
+ clarifai/client/runner.py,sha256=oZkydj1Lfxn6pVx4_-CLzyaneE-dHvBIGL44usW45gA,9867
14
+ clarifai/client/search.py,sha256=XadJjdV1PqM288LcU6DSnKmaiuVi7kzA5Tt1q0mS_Js,10767
15
+ clarifai/client/user.py,sha256=QYngaFYINw-U-3FUwyrN2rFbwGyaHavuCXMGqV34pWA,10139
16
+ clarifai/client/workflow.py,sha256=oALMJfdgTqiilfpDT3H_nepqX9mexLu-uWV0NvtxUs0,10291
17
17
  clarifai/client/auth/__init__.py,sha256=7EwR0NrozkAUwpUnCsqXvE_p0wqx_SelXlSpKShKJK0,136
18
18
  clarifai/client/auth/helper.py,sha256=3lCKo24ZIOlcSh50juJh3ZDagOo_pxEKyoPjWUokYoA,13450
19
19
  clarifai/client/auth/register.py,sha256=2CMdBsoVLoTfjyksE6j7BM2tiEc73WKYvxnwDDgNn1k,536
@@ -32,13 +32,12 @@ clarifai/datasets/upload/features.py,sha256=KeVxO36WrL3uqWCN_-aex1k28C5ZRTm6G8Sm
32
32
  clarifai/datasets/upload/image.py,sha256=Dlt0RM9qWSi4NcbVM1EjS1sp8zfIO3xWZS6TSSLAbVY,7481
33
33
  clarifai/datasets/upload/text.py,sha256=ek29V18x5LqmHqc-nmAljQcud9uRjZx8IV_lDX78zsY,1980
34
34
  clarifai/datasets/upload/utils.py,sha256=h7mtN9FZXhQQbf47EXczgb-NTY2uOE9AJlE9u4-hDwI,9627
35
- clarifai/datasets/upload/loaders/README.md,sha256=ag-3lXuvsKTZapvnqBv824rMrVeX0i9U5v1oqhdhvoo,3038
35
+ clarifai/datasets/upload/loaders/README.md,sha256=aNRutSCTzLp2ruIZx74ZkN5AxpzwKOxMa7OzabnKpwg,2980
36
36
  clarifai/datasets/upload/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  clarifai/datasets/upload/loaders/coco_captions.py,sha256=t-IaIXukDk1mFdeeqdwe0hLrBLuaF-cZWl2aumGUAls,1297
38
38
  clarifai/datasets/upload/loaders/coco_detection.py,sha256=dBYl2a1D7e-N1heXbFK0bImJAuq_lPQ8nxZMa1zq-Ts,2612
39
- clarifai/datasets/upload/loaders/coco_segmentation.py,sha256=yu9HBHYdKCllF9-6SdQ_2CaKGskE4DdeqCin7zNTN1c,3628
40
39
  clarifai/datasets/upload/loaders/imagenet_classification.py,sha256=LuylazxpI5V8fAPGCUxDirGpYMfxzRxix-MEWaCvwxI,1895
41
- clarifai/datasets/upload/loaders/xview_detection.py,sha256=bSdmEA_YC-uHl-5uSy3HNnxGVAi9I4N_wjOS0hlbW34,6071
40
+ clarifai/datasets/upload/loaders/xview_detection.py,sha256=hk8cZdYZimm4KOaZvBjYcC6ikURZMn51xmn7pXZT3HE,6052
42
41
  clarifai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
42
  clarifai/models/api.py,sha256=d3FQQlG0mNDLrfEvchqaVcq4Tgb_TqryNnJtwp3c7sE,10961
44
43
  clarifai/models/model_serving/README.md,sha256=Ln8hsyE38J3yiLZruKHjU_hdq9CjzzbDUAO28Xyw1dQ,4060
@@ -91,8 +90,8 @@ clarifai/modules/css.py,sha256=kadCEunmyh5h2yf0-4aysE3ZcZ6qaQcxuAgDXS96yF8,2020
91
90
  clarifai/modules/pages.py,sha256=iOoM3RNRMgXlV0qBqcdQofxoXo2RuRQh0h9c9BIS0-I,1383
92
91
  clarifai/modules/style.css,sha256=j7FNPZVhLPj35vvBksAJ90RuX5sLuqzDR5iM2WIEhiA,6073
93
92
  clarifai/rag/__init__.py,sha256=wu3PzAzo7uqgrEzuaC9lY_3gj1HFiR3GU3elZIKTT5g,40
94
- clarifai/rag/rag.py,sha256=N4nhjFRqV2bCPE0W4utsFe8F_5ajhHOF95LRbDLUpC8,11661
95
- clarifai/rag/utils.py,sha256=1FtQ3_URdtMQpHZdGeDLGibhvcAvKQ8J7ctecATLEhs,3435
93
+ clarifai/rag/rag.py,sha256=fYCIs9WJKugRFZ6Xt468_7PE6ipE3x4DfaQzvw4EkuY,12392
94
+ clarifai/rag/utils.py,sha256=aqAM120xC8DcpqWMrsKsmT9QwrKKJZYBLyDgYb8_L-8,4061
96
95
  clarifai/runners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
97
96
  clarifai/runners/example.py,sha256=V0Nc52JkhCm97oaWzKVg71g50M1ltxI9jyPMo6tKU6E,1302
98
97
  clarifai/runners/example_llama2.py,sha256=WMGTqv3v9t3ID1rjW9BTLMkIuvyTESL6xHcOO6A220Y,2712
@@ -101,14 +100,16 @@ clarifai/urls/helper.py,sha256=tjoMGGHuWX68DUB0pk4MEjrmFsClUAQj2jmVEM_Sy78,4751
101
100
  clarifai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
101
  clarifai/utils/logging.py,sha256=F19UmdeJKwIy8Nqo8o0hegf-qJGqzqtQ5Bi0Rz2NP4Q,3582
103
102
  clarifai/utils/misc.py,sha256=cC_j0eEsJ8bfnj0oRd2z-Rms1mQbAfLwrSs07hwQuCE,1420
104
- clarifai/utils/model_train.py,sha256=v4-bsPOOi-jxzwDxdNf2exaWPEpKD7BYcc6w0kMds4o,7832
103
+ clarifai/utils/model_train.py,sha256=JlMJAclOQ6Nx4_30DiQrlgHbQnNedl9UKQILq_HwK7I,8001
104
+ clarifai/utils/evaluation/__init__.py,sha256=0gmQxbzejnv1tKLj4lKcV7DHQX69irBJkWhA9oYXL1k,15813
105
+ clarifai/utils/evaluation/helpers.py,sha256=d_dcASRI_lhsHIRukAF1S-w7XazLpK9y6E_ug3l50t4,18440
105
106
  clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
107
  clarifai/workflows/export.py,sha256=vICRhIreqDSShxLKjHNM2JwzKsf1B4fdXB0ciMcA70k,1945
107
108
  clarifai/workflows/utils.py,sha256=nGeB_yjVgUO9kOeKTg4OBBaBz-AwXI3m-huSVj-9W18,1924
108
109
  clarifai/workflows/validate.py,sha256=iCEKBTtB-57uE3LVU7D4AI9BRHxIxahk3U1Ro08HP-o,2535
109
- clarifai-10.1.0.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
110
- clarifai-10.1.0.dist-info/METADATA,sha256=zWB-J2f4iI9LDEc9mUTq-xK2TLJs7WzFiLQwnnNtS1g,17381
111
- clarifai-10.1.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
112
- clarifai-10.1.0.dist-info/entry_points.txt,sha256=qZOr_MIPG0dBBE1zringDJS_wXNGTAA_SQ-zcbmDHOw,82
113
- clarifai-10.1.0.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
114
- clarifai-10.1.0.dist-info/RECORD,,
110
+ clarifai-10.1.1.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
111
+ clarifai-10.1.1.dist-info/METADATA,sha256=oSrsyv-IDTTXBLdKGNaIeyHVh2vxkUj5FXNNbRcFa2c,18007
112
+ clarifai-10.1.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
113
+ clarifai-10.1.1.dist-info/entry_points.txt,sha256=qZOr_MIPG0dBBE1zringDJS_wXNGTAA_SQ-zcbmDHOw,82
114
+ clarifai-10.1.1.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
115
+ clarifai-10.1.1.dist-info/RECORD,,
@@ -1,98 +0,0 @@
1
- #! COCO 2017 Image Segmentation dataset
2
-
3
- import gc
4
- import os
5
- from functools import reduce
6
-
7
- import cv2
8
- import numpy as np
9
- from pycocotools import mask as maskUtils
10
- from pycocotools.coco import COCO
11
-
12
- from clarifai.datasets.upload.base import ClarifaiDataLoader
13
-
14
- from ..features import VisualSegmentationFeatures
15
-
16
-
17
- class COCOSegmentationDataLoader(ClarifaiDataLoader):
18
- """COCO Image Segmentation Dataset."""
19
-
20
- def __init__(self, images_dir, label_filepath):
21
- """
22
- Args:
23
- images_dir: Directory containing the images.
24
- label_filepath: Path to the COCO annotation file.
25
- """
26
- self.images_dir = images_dir
27
- self.label_filepath = label_filepath
28
-
29
- self.map_ids = {}
30
- self.load_data()
31
-
32
- @property
33
- def task(self):
34
- return "visual_segmentation"
35
-
36
- def load_data(self) -> None:
37
- self.coco = COCO(self.label_filepath)
38
- self.map_ids = {i: img_id for i, img_id in enumerate(list(self.coco.imgs.keys()))}
39
-
40
- def __len__(self):
41
- return len(self.coco.imgs)
42
-
43
- def __getitem__(self, index):
44
- """Get image and annotations for a given index."""
45
- value = self.coco.imgs[self.map_ids[index]]
46
- image_path = os.path.join(self.images_dir, value['file_name'])
47
- annots = [] # polygons
48
- concept_ids = []
49
-
50
- input_ann_ids = self.coco.getAnnIds(imgIds=[value['id']])
51
- input_anns = self.coco.loadAnns(input_ann_ids)
52
-
53
- for ann in input_anns:
54
- # get concept info
55
- # note1: concept_name can be human readable
56
- # note2: concept_id can only be alphanumeric, up to 32 characters, with no special chars except `-` and `_`
57
- concept_name = self.coco.cats[ann['category_id']]['name']
58
- concept_id = concept_name.lower().replace(' ', '-')
59
-
60
- # get polygons
61
- if isinstance(ann['segmentation'], list):
62
- poly = np.array(ann['segmentation']).reshape((int(len(ann['segmentation'][0]) / 2),
63
- 2)).astype(float)
64
- poly[:, 0], poly[:, 1] = poly[:, 0] / value['width'], poly[:, 1] / value['height']
65
- poly = np.clip(poly, 0, 1)
66
- annots.append(poly.tolist()) #[[x=col, y=row],...]
67
- concept_ids.append(concept_id)
68
- else: # seg: {"counts":[...]}
69
- if isinstance(ann['segmentation']['counts'], list):
70
- rle = maskUtils.frPyObjects([ann['segmentation']], value['height'], value['width'])
71
- else:
72
- rle = ann['segmentation']
73
- mask = maskUtils.decode(rle) #binary mask
74
- #convert mask to polygons and add to annots
75
- contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
76
- polygons = []
77
- for cont in contours:
78
- if cont.size >= 6:
79
- polygons.append(cont.astype(float).flatten().tolist())
80
- # store polygons in (x,y) pairs
81
- polygons_flattened = reduce(lambda x, y: x + y, polygons)
82
- del polygons
83
- del contours
84
- del mask
85
- gc.collect()
86
-
87
- polygons = np.array(polygons_flattened).reshape((int(len(polygons_flattened) / 2),
88
- 2)).astype(float)
89
- polygons[:, 0] = polygons[:, 0] / value['width']
90
- polygons[:, 1] = polygons[:, 1] / value['height']
91
- polygons = np.clip(polygons, 0, 1)
92
- annots.append(polygons.tolist()) #[[x=col, y=row],...,[x=col, y=row]]
93
- concept_ids.append(concept_id)
94
-
95
- assert len(concept_ids) == len(annots), f"Num concepts must match num bbox annotations\
96
- for a single image. Found {len(concept_ids)} concepts and {len(annots)} bboxes."
97
-
98
- return VisualSegmentationFeatures(image_path, concept_ids, annots, id=str(value['id']))