# smretrofit
smretrofit is a Python library designed to process video and image data using machine learning models hosted on the Somikoron API. This library provides functionalities to analyze videos and images, detecting defects and generating ratings based on various criteria.
You can find the source code and documentation for smretrofit on [GitHub](https://github.com/somikoronAI-Source/smretrofit.git).
For reporting issues or feature requests, please visit the [issues page](https://github.com/somikoronAI-Source/smretrofit/issues/1).
## Features
- **Video Processing**: Analyze video files frame-by-frame, extract random samples, and save processed frames.
- **Image Processing**: Send image files to the Somikoron API for defect detection and rating.
- **Flexible Modes**: Choose between different modes (`all`, `defect`, `rating`) for tailored outputs.
- **Customizable Parameters**: Adjust font size, thickness, and line spacing for visual annotations.
## Installation
You can install the required packages using pip:
```bash
pip install opencv-python requests Pillow numpy cryptography
```
## Usage
### Initializing the Retrofit Class
To use the SMRetrofit library, you first need to initialize the Retrofit class:
```bash
from smretrofit import Retrofit
# Initialize the Retrofit object
retrofit = Retrofit(auth_key="YOUR_AUTH_KEY", auth_pass="YOUR_AUTH_PASS")
```
### Analyzing a Few Video Frame
To analyze a video and save the output frames:
```bash
result_data = retrofit.get_video_data_sample("path/to/video.mp4", save=True)
```
### Analyzing Full Video
To analyze a video and save the output frames:
```bash
result_data = retrofit.get_video_data("path/to/video.mp4", save=True)
```
### Analyzing an Image
To analyze an image:
```bash
results = retrofit.get_image_data("path/to/image.jpg", save=True)
```
## Parameters
- **url**: API endpoint for Somikoron. Default is "https://api.somikoron.ai/api/".
- **auth_key**: Your authentication key for the API.
- **auth_pass**: Your authentication password for the API.
- **font_size**: Size of the font for labels (default: 7).
- **font_thickness**: Thickness of the font for labels (default: 3).
- **line_space**: Space between lines of labels (default: 10).
- **detect_mode**: Detect Mode of operation (all, defect, rating).
- **label_mode**: Label Mode of operation (all, defect, rating).
## Example
Here’s a simple example demonstrating how to use the library:
```bash
from smretrofit import Retrofit
# Create an instance of the Retrofit class
retrofit = Retrofit(auth_key="YOUR_AUTH_KEY", auth_pass="YOUR_AUTH_PASS")
# Process a video
result_data = retrofit.get_video_data("path/to/video.mp4", save=True)
# Process an image
results = retrofit.get_image_data("path/to/image.jpg", save=True)
```
Raw data
{
"_id": null,
"home_page": "https://www.somikoron.ai",
"name": "smretrofit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "computer vision requests image and video processing",
"author": "Somikoron",
"author_email": "contact@somikoron.ai",
"download_url": "https://files.pythonhosted.org/packages/8b/e1/d0d765c9c52dcc1f586e325c2ba624fa3897db07f4d7496d89a689761e37/smretrofit-1.0.4.tar.gz",
"platform": null,
"description": "# smretrofit\n\nsmretrofit is a Python library designed to process video and image data using machine learning models hosted on the Somikoron API. This library provides functionalities to analyze videos and images, detecting defects and generating ratings based on various criteria.\n\nYou can find the source code and documentation for smretrofit on [GitHub](https://github.com/somikoronAI-Source/smretrofit.git).\n\nFor reporting issues or feature requests, please visit the [issues page](https://github.com/somikoronAI-Source/smretrofit/issues/1).\n\n## Features\n\n- **Video Processing**: Analyze video files frame-by-frame, extract random samples, and save processed frames.\n- **Image Processing**: Send image files to the Somikoron API for defect detection and rating.\n- **Flexible Modes**: Choose between different modes (`all`, `defect`, `rating`) for tailored outputs.\n- **Customizable Parameters**: Adjust font size, thickness, and line spacing for visual annotations.\n\n## Installation\n\nYou can install the required packages using pip:\n```bash\npip install opencv-python requests Pillow numpy cryptography\n```\n## Usage\n\n### Initializing the Retrofit Class\n\nTo use the SMRetrofit library, you first need to initialize the Retrofit class:\n```bash\nfrom smretrofit import Retrofit\n\n# Initialize the Retrofit object\nretrofit = Retrofit(auth_key=\"YOUR_AUTH_KEY\", auth_pass=\"YOUR_AUTH_PASS\")\n```\n\n### Analyzing a Few Video Frame\n\nTo analyze a video and save the output frames:\n```bash\nresult_data = retrofit.get_video_data_sample(\"path/to/video.mp4\", save=True)\n```\n\n### Analyzing Full Video\n\nTo analyze a video and save the output frames:\n```bash\nresult_data = retrofit.get_video_data(\"path/to/video.mp4\", save=True)\n```\n### Analyzing an Image\n\nTo analyze an image:\n```bash\nresults = retrofit.get_image_data(\"path/to/image.jpg\", save=True)\n```\n## Parameters\n\n- **url**: API endpoint for Somikoron. Default is \"https://api.somikoron.ai/api/\".\n- **auth_key**: Your authentication key for the API.\n- **auth_pass**: Your authentication password for the API.\n- **font_size**: Size of the font for labels (default: 7).\n- **font_thickness**: Thickness of the font for labels (default: 3).\n- **line_space**: Space between lines of labels (default: 10).\n- **detect_mode**: Detect Mode of operation (all, defect, rating).\n- **label_mode**: Label Mode of operation (all, defect, rating).\n\n## Example\n\nHere\u2019s a simple example demonstrating how to use the library:\n```bash\nfrom smretrofit import Retrofit\n\n# Create an instance of the Retrofit class\nretrofit = Retrofit(auth_key=\"YOUR_AUTH_KEY\", auth_pass=\"YOUR_AUTH_PASS\")\n\n# Process a video\nresult_data = retrofit.get_video_data(\"path/to/video.mp4\", save=True)\n\n# Process an image\nresults = retrofit.get_image_data(\"path/to/image.jpg\", save=True)\n```\n",
"bugtrack_url": null,
"license": "Somikoron License",
"summary": null,
"version": "1.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/somikoronAI-Source/smretrofit/issues/1",
"Documentation": "https://api.somikoron.ai",
"Homepage": "https://www.somikoron.ai",
"Source": "https://github.com/somikoronAI-Source/smretrofit.git"
},
"split_keywords": [
"computer",
"vision",
"requests",
"image",
"and",
"video",
"processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "864b647490ab44bc0460e0c8027cb7efb8dd57aa44406de14b8a6e19d3898071",
"md5": "ac98fb0ba2d519f1622caac3144c376f",
"sha256": "bc477f608163857c2f24d51a548464b38ad617732db4279805792812d22a6ab2"
},
"downloads": -1,
"filename": "smretrofit-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac98fb0ba2d519f1622caac3144c376f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7981,
"upload_time": "2024-10-26T08:58:12",
"upload_time_iso_8601": "2024-10-26T08:58:12.106539Z",
"url": "https://files.pythonhosted.org/packages/86/4b/647490ab44bc0460e0c8027cb7efb8dd57aa44406de14b8a6e19d3898071/smretrofit-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8be1d0d765c9c52dcc1f586e325c2ba624fa3897db07f4d7496d89a689761e37",
"md5": "61ff8ebf55a592e90a558010c53c3e55",
"sha256": "5899f5bbd09e151ce0e5016510ae6692c766a8712bfbbd3826403a6ec6fa0acd"
},
"downloads": -1,
"filename": "smretrofit-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "61ff8ebf55a592e90a558010c53c3e55",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8890,
"upload_time": "2024-10-26T08:58:16",
"upload_time_iso_8601": "2024-10-26T08:58:16.519381Z",
"url": "https://files.pythonhosted.org/packages/8b/e1/d0d765c9c52dcc1f586e325c2ba624fa3897db07f4d7496d89a689761e37/smretrofit-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 08:58:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "somikoronAI-Source",
"github_project": "smretrofit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smretrofit"
}