pv-audit 0.1.2__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.
- pv_audit-0.1.2/PKG-INFO +13 -0
- pv_audit-0.1.2/pv_audit/__init__.py +13 -0
- pv_audit-0.1.2/pv_audit/engine.py +23 -0
- pv_audit-0.1.2/pv_audit/interface.py +19 -0
- pv_audit-0.1.2/pv_audit/reporter.py +18 -0
- pv_audit-0.1.2/pv_audit/stress.py +19 -0
- pv_audit-0.1.2/pv_audit.egg-info/PKG-INFO +13 -0
- pv_audit-0.1.2/pv_audit.egg-info/SOURCES.txt +11 -0
- pv_audit-0.1.2/pv_audit.egg-info/dependency_links.txt +1 -0
- pv_audit-0.1.2/pv_audit.egg-info/requires.txt +5 -0
- pv_audit-0.1.2/pv_audit.egg-info/top_level.txt +1 -0
- pv_audit-0.1.2/setup.cfg +4 -0
- pv_audit-0.1.2/setup.py +10 -0
pv_audit-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pv-audit
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Industrial AI Robustness Audit SDK
|
|
5
|
+
Author: shef9432
|
|
6
|
+
Requires-Dist: numpy
|
|
7
|
+
Requires-Dist: opencv-python
|
|
8
|
+
Requires-Dist: pandas
|
|
9
|
+
Requires-Dist: seaborn
|
|
10
|
+
Requires-Dist: matplotlib
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: requires-dist
|
|
13
|
+
Dynamic: summary
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .interface import BaseAdapter
|
|
2
|
+
from .engine import AuditEngine
|
|
3
|
+
from .reporter import AuditReporter
|
|
4
|
+
|
|
5
|
+
class AuditAgent:
|
|
6
|
+
def __init__(self, adapter):
|
|
7
|
+
self.engine = AuditEngine(adapter)
|
|
8
|
+
|
|
9
|
+
def run(self, image, dims, lvls):
|
|
10
|
+
raw_data = self.engine.run_audit(image, dims, lvls)
|
|
11
|
+
return AuditReporter(raw_data)
|
|
12
|
+
|
|
13
|
+
__version__ = "0.1.2"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from .stress import StressSimulator
|
|
2
|
+
|
|
3
|
+
class AuditEngine:
|
|
4
|
+
def __init__(self, adapter):
|
|
5
|
+
self.adapter = adapter
|
|
6
|
+
self.operators = {
|
|
7
|
+
"Lux+": StressSimulator.apply_lux_plus,
|
|
8
|
+
"MBlur": StressSimulator.apply_mblur,
|
|
9
|
+
"ISO": StressSimulator.apply_iso_noise
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def run_audit(self, image: np.ndarray, dims: list, lvls: list) -> list:
|
|
13
|
+
report_data = []
|
|
14
|
+
for dim in dims:
|
|
15
|
+
for lvl in lvls:
|
|
16
|
+
stressed_img = self.operators[dim](image, lvl)
|
|
17
|
+
prediction = self.adapter.predict(stressed_img)
|
|
18
|
+
report_data.append({
|
|
19
|
+
"dimension": dim,
|
|
20
|
+
"level": lvl,
|
|
21
|
+
"conf": prediction['conf']
|
|
22
|
+
})
|
|
23
|
+
return report_data
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
class BaseAdapter(ABC):
|
|
5
|
+
"""
|
|
6
|
+
Interface for model inference adaptation.
|
|
7
|
+
All custom models must implement this protocol.
|
|
8
|
+
"""
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def predict(self, image: np.ndarray) -> dict:
|
|
11
|
+
"""
|
|
12
|
+
Args:
|
|
13
|
+
image: Preprocessed numpy array (BGR/RGB).
|
|
14
|
+
Returns:
|
|
15
|
+
A dictionary containing:
|
|
16
|
+
- 'data': Model raw output (e.g., boxes or masks)
|
|
17
|
+
- 'conf': Confidence score (float)
|
|
18
|
+
"""
|
|
19
|
+
pass
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import seaborn as sns
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
|
|
5
|
+
class AuditReporter:
|
|
6
|
+
def __init__(self, data: list):
|
|
7
|
+
self.df = pd.DataFrame(data)
|
|
8
|
+
|
|
9
|
+
def to_csv(self, filepath: str):
|
|
10
|
+
self.df.to_csv(filepath, index=False)
|
|
11
|
+
|
|
12
|
+
def plot_trend(self, filepath: str):
|
|
13
|
+
plt.figure(figsize=(10, 6))
|
|
14
|
+
sns.lineplot(data=self.df, x="level", y="conf", hue="dimension", marker="o")
|
|
15
|
+
plt.title("AI Model Robustness Trend")
|
|
16
|
+
plt.grid(True)
|
|
17
|
+
plt.savefig(filepath)
|
|
18
|
+
plt.close()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import cv2
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
class StressSimulator:
|
|
5
|
+
"""Physics-based degradation operators for industrial environments."""
|
|
6
|
+
|
|
7
|
+
@staticmethod
|
|
8
|
+
def apply_lux_plus(img: np.ndarray, val: int) -> np.ndarray:
|
|
9
|
+
return np.clip(img.astype(np.float32) * (1 + val / 50), 0, 255).astype(np.uint8)
|
|
10
|
+
|
|
11
|
+
@staticmethod
|
|
12
|
+
def apply_mblur(img: np.ndarray, val: int) -> np.ndarray:
|
|
13
|
+
kernel_size = int(val / 10) * 2 + 1
|
|
14
|
+
return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0) if kernel_size > 1 else img
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def apply_iso_noise(img: np.ndarray, val: int) -> np.ndarray:
|
|
18
|
+
noise = np.random.normal(0, val, img.shape)
|
|
19
|
+
return np.clip(img.astype(np.float32) + noise, 0, 255).astype(np.uint8)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pv-audit
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Industrial AI Robustness Audit SDK
|
|
5
|
+
Author: shef9432
|
|
6
|
+
Requires-Dist: numpy
|
|
7
|
+
Requires-Dist: opencv-python
|
|
8
|
+
Requires-Dist: pandas
|
|
9
|
+
Requires-Dist: seaborn
|
|
10
|
+
Requires-Dist: matplotlib
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: requires-dist
|
|
13
|
+
Dynamic: summary
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
setup.py
|
|
2
|
+
pv_audit/__init__.py
|
|
3
|
+
pv_audit/engine.py
|
|
4
|
+
pv_audit/interface.py
|
|
5
|
+
pv_audit/reporter.py
|
|
6
|
+
pv_audit/stress.py
|
|
7
|
+
pv_audit.egg-info/PKG-INFO
|
|
8
|
+
pv_audit.egg-info/SOURCES.txt
|
|
9
|
+
pv_audit.egg-info/dependency_links.txt
|
|
10
|
+
pv_audit.egg-info/requires.txt
|
|
11
|
+
pv_audit.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pv_audit
|
pv_audit-0.1.2/setup.cfg
ADDED
pv_audit-0.1.2/setup.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="pv-audit",
|
|
5
|
+
version="0.1.2",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=["numpy", "opencv-python", "pandas", "seaborn", "matplotlib"],
|
|
8
|
+
author="shef9432",
|
|
9
|
+
description="Industrial AI Robustness Audit SDK"
|
|
10
|
+
)
|