mct-nightly 1.11.0.20240323.408__py3-none-any.whl → 1.11.0.20240325.447__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.
- {mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/METADATA +1 -1
- {mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/RECORD +7 -8
- model_compression_toolkit/__init__.py +1 -1
- model_compression_toolkit/core/__init__.py +0 -1
- model_compression_toolkit/core/common/data_loader.py +0 -108
- {mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/LICENSE.md +0 -0
- {mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/WHEEL +0 -0
- {mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/top_level.txt +0 -0
{mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/RECORD
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
model_compression_toolkit/__init__.py,sha256=
|
|
1
|
+
model_compression_toolkit/__init__.py,sha256=1F1glob4ZWrvvQSjXuNtPoOii_8SkKVI36oE5u49hPs,1574
|
|
2
2
|
model_compression_toolkit/constants.py,sha256=KW_HUEPmQEYqCvWGyORqkYxpvO7w5LViB5J5D-pm_6o,3648
|
|
3
3
|
model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
|
|
4
4
|
model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
|
|
5
|
-
model_compression_toolkit/core/__init__.py,sha256=
|
|
5
|
+
model_compression_toolkit/core/__init__.py,sha256=TrRgkWpT1AN2Faw1M_1HXyJkJnbxfn9p-RigDZl7pg0,1982
|
|
6
6
|
model_compression_toolkit/core/analyzer.py,sha256=dbsD61pakp_9JXNyAScLdtJvcXny9jr_cMbET0Bd3Sg,2975
|
|
7
7
|
model_compression_toolkit/core/exporter.py,sha256=Zo_C5GjIzihtJOyGp-xeCVhY_qohkVz_EGyrSZCbWRM,4115
|
|
8
8
|
model_compression_toolkit/core/graph_prep_runner.py,sha256=Ftqm59hT5TGWmSNkY9bFZkVfCacpGyZfCe-6yZR5WY0,10100
|
|
@@ -10,7 +10,6 @@ model_compression_toolkit/core/quantization_prep_runner.py,sha256=hFhDkS8GwzXZ7H
|
|
|
10
10
|
model_compression_toolkit/core/runner.py,sha256=NKSC6ujfQPy6dKtJVwxyK2zNDd64eyR5csYy9lBrCPA,11836
|
|
11
11
|
model_compression_toolkit/core/common/__init__.py,sha256=Wh127PbXcETZX_d1PQqZ71ETK3J9XO5A-HpadGUbj6o,1447
|
|
12
12
|
model_compression_toolkit/core/common/base_substitutions.py,sha256=xDFSmVVs_iFSZfajytI0cuQaNRNcwHX3uqOoHgVUvxQ,1666
|
|
13
|
-
model_compression_toolkit/core/common/data_loader.py,sha256=yNNXa1AEgQ3OpaXqH0QvKsu4Kom_AcRjBq_visHwd7s,4170
|
|
14
13
|
model_compression_toolkit/core/common/framework_implementation.py,sha256=njBP3elCFiSHyT2Y9zT1ISyDeQFR3j5UzPR4XQK2KnY,21152
|
|
15
14
|
model_compression_toolkit/core/common/framework_info.py,sha256=1ZMMGS9ip-kSflqkartyNRt9aQ5ub1WepuTRcTy-YSQ,6337
|
|
16
15
|
model_compression_toolkit/core/common/memory_computation.py,sha256=ixoSpV5ZYZGyzhre3kQcvR2sNA8KBsPZ3lgbkDnw9Cs,1205
|
|
@@ -472,8 +471,8 @@ model_compression_toolkit/trainable_infrastructure/keras/quantize_wrapper.py,sha
|
|
|
472
471
|
model_compression_toolkit/trainable_infrastructure/keras/quantizer_utils.py,sha256=MVwXNymmFRB2NXIBx4e2mdJ1RfoHxRPYRgjb1MQP5kY,1797
|
|
473
472
|
model_compression_toolkit/trainable_infrastructure/pytorch/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
|
|
474
473
|
model_compression_toolkit/trainable_infrastructure/pytorch/base_pytorch_quantizer.py,sha256=7bbzqJN8ZAycVDvZr_5xC-niTAR5df8f03Kooev_pfg,3047
|
|
475
|
-
mct_nightly-1.11.0.
|
|
476
|
-
mct_nightly-1.11.0.
|
|
477
|
-
mct_nightly-1.11.0.
|
|
478
|
-
mct_nightly-1.11.0.
|
|
479
|
-
mct_nightly-1.11.0.
|
|
474
|
+
mct_nightly-1.11.0.20240325.447.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
|
475
|
+
mct_nightly-1.11.0.20240325.447.dist-info/METADATA,sha256=Zr1H3JtZ9ye9UCxLLqm47S-3Gjyvkviex-Ur6i7TFNM,19146
|
|
476
|
+
mct_nightly-1.11.0.20240325.447.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
477
|
+
mct_nightly-1.11.0.20240325.447.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
|
478
|
+
mct_nightly-1.11.0.20240325.447.dist-info/RECORD,,
|
|
@@ -27,4 +27,4 @@ from model_compression_toolkit import data_generation
|
|
|
27
27
|
from model_compression_toolkit import pruning
|
|
28
28
|
from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model
|
|
29
29
|
|
|
30
|
-
__version__ = "1.11.0.
|
|
30
|
+
__version__ = "1.11.0.20240325.000447"
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
# ==============================================================================
|
|
15
15
|
|
|
16
|
-
from model_compression_toolkit.core.common.data_loader import FolderImageLoader
|
|
17
16
|
from model_compression_toolkit.core.common.framework_info import FrameworkInfo, ChannelAxis
|
|
18
17
|
from model_compression_toolkit.core.common import network_editors as network_editor
|
|
19
18
|
from model_compression_toolkit.core.common.quantization.debug_config import DebugConfig
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# Copyright 2021 Sony Semiconductor Israel, Inc. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
# ==============================================================================
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import os
|
|
18
|
-
from typing import List, Callable
|
|
19
|
-
|
|
20
|
-
import numpy as np
|
|
21
|
-
from PIL import Image
|
|
22
|
-
from model_compression_toolkit.logger import Logger
|
|
23
|
-
|
|
24
|
-
#:
|
|
25
|
-
FILETYPES = ['jpeg', 'jpg', 'bmp', 'png']
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class FolderImageLoader(object):
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
Class for images loading, processing and retrieving.
|
|
32
|
-
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
def __init__(self,
|
|
36
|
-
folder: str,
|
|
37
|
-
preprocessing: List[Callable],
|
|
38
|
-
batch_size: int,
|
|
39
|
-
file_types: List[str] = FILETYPES):
|
|
40
|
-
|
|
41
|
-
""" Initialize a FolderImageLoader object.
|
|
42
|
-
|
|
43
|
-
Args:
|
|
44
|
-
folder: Path of folder with images to load. The path has to exist, and has to contain at
|
|
45
|
-
least one image.
|
|
46
|
-
preprocessing: List of functions to use when processing the images before retrieving them.
|
|
47
|
-
batch_size: Number of images to retrieve each sample.
|
|
48
|
-
file_types: Files types to scan in the folder. Default list is :data:`~model_compression_toolkit.core.common.data_loader.FILETYPES`
|
|
49
|
-
|
|
50
|
-
Examples:
|
|
51
|
-
|
|
52
|
-
Instantiate a FolderImageLoader using a directory of images, that returns 10 images randomly each time it is sampled:
|
|
53
|
-
|
|
54
|
-
>>> image_data_loader = FolderImageLoader('path/to/images/directory', preprocessing=[], batch_size=10)
|
|
55
|
-
>>> images = image_data_loader.sample()
|
|
56
|
-
|
|
57
|
-
To preprocess the images before retrieving them, a list of preprocessing methods can be passed:
|
|
58
|
-
|
|
59
|
-
>>> image_data_loader = FolderImageLoader('path/to/images/directory', preprocessing=[lambda x: (x-127.5)/127.5], batch_size=10)
|
|
60
|
-
|
|
61
|
-
For the FolderImageLoader to scan only specific files extensions, a list of extensions can be passed:
|
|
62
|
-
|
|
63
|
-
>>> image_data_loader = FolderImageLoader('path/to/images/directory', preprocessing=[], batch_size=10, file_types=['png'])
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
self.folder = folder
|
|
68
|
-
self.image_list = []
|
|
69
|
-
Logger.info(f"Starting Scanning Disk: {self.folder}")
|
|
70
|
-
for root, dirs, files in os.walk(self.folder):
|
|
71
|
-
for file in files:
|
|
72
|
-
file_type = file.split('.')[-1].lower()
|
|
73
|
-
if file_type in file_types:
|
|
74
|
-
self.image_list.append(os.path.join(root, file))
|
|
75
|
-
self.n_files = len(self.image_list)
|
|
76
|
-
if self.n_files == 0:
|
|
77
|
-
Logger.critical(f"Expected files of type {FILETYPES}. No files of type {FILETYPES} were found.") # pragma: no cover
|
|
78
|
-
Logger.info(f"Finished Disk Scanning: Found {self.n_files} files")
|
|
79
|
-
self.preprocessing = preprocessing
|
|
80
|
-
self.batch_size = batch_size
|
|
81
|
-
|
|
82
|
-
def _sample(self):
|
|
83
|
-
"""
|
|
84
|
-
Read batch_size random images from the image_list the FolderImageLoader holds.
|
|
85
|
-
Process them using the preprocessing list that was passed at initialization, and
|
|
86
|
-
prepare it for retrieving.
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
index = np.random.randint(0, self.n_files, self.batch_size)
|
|
90
|
-
image_list = []
|
|
91
|
-
for i in index:
|
|
92
|
-
file = self.image_list[i]
|
|
93
|
-
img = np.uint8(np.array(Image.open(file).convert('RGB')))
|
|
94
|
-
for p in self.preprocessing: # preprocess images
|
|
95
|
-
img = p(img)
|
|
96
|
-
image_list.append(img)
|
|
97
|
-
self.next_batch_data = np.stack(image_list, axis=0)
|
|
98
|
-
|
|
99
|
-
def sample(self):
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
Returns: A sample of batch_size images from the folder the FolderImageLoader scanned.
|
|
103
|
-
|
|
104
|
-
"""
|
|
105
|
-
|
|
106
|
-
self._sample()
|
|
107
|
-
data = self.next_batch_data # get current data
|
|
108
|
-
return data
|
{mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/LICENSE.md
RENAMED
|
File without changes
|
{mct_nightly-1.11.0.20240323.408.dist-info → mct_nightly-1.11.0.20240325.447.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|