A training core function that can be installed for various projects
Project description
Summary
This module is used to auto train model from captured images and videos.
The goal is to allow product be a black box which and start to capture images and videos then train model for defect detection.
Usage
Create your configuration and create DiffernetUtil
conf = settings.DIFFERNET_CONF
logger.info(f"working folder: {conf.get('differnet_work_dir')}")
differnetutil = DiffernetUtil(conf, "pink1")
configuration like this. Any value not set will be taken from default
#common settings.
DIFFERNET_CONF = {
"differnet_work_dir": "./work",
"device": "cuda", # cuda or cpu
"device_id": 5,
"verbose": True,
# "rotation_degree": 0,
# "crop_top": 0.10,
# "crop_left": 0.10,
# "crop_bottom": 0.10,
# "crop_right": 0.10,
# training setting
"meta_epochs": 5,
"sub_epochs": 8,
# # output settings
"grad_map_viz": False,
# "save_model": True,
"save_transformed_image": False,
# "visualization": False,
# "target_tpr": 0.76,
"test_anormaly_target": 10,
}
prepare the training and testing data
The data structure under work folder looks like this. The model folder will save trained model. For experiment purpose, you would like to give test and validate folder with proper labled data. While, for zerobox it only requires train folder and data. The minimum images is 16 based on the differnet paper.
pink1/
├── model
├── test
│ ├── defect
│ └── good
├─── validate
│ ├── defect
│ └── good
└── train
└── good
├── 01.jpg
├── 02.jpg
├── 03.jpg
├── 04.jpg
├── 05.jpg
├── 06.jpg
├── 07.jpg
├── 08.jpg
├── 09.jpg
├── 10.jpg
├── 11.jpg
├── 12.jpg
├── 13.jpg
├── 14.jpg
├── 15.jpg
└── 16.jpg
dependencies
Python 3.9 + torch 1.8.1 + torchvision 0.9.1. In order to make proper use of cuda or cpu you may need install torch and torch vision based on instructions from pytroch.org
Notice: Older version of torch does not work with python 3.9
scikit-learn>=0.22
scipy>=1.3.2
numpy>=1.17.4
torch=1.8.1
torchvision=0.9.1
matplotlib>=3.0.3
tqdm>=4.59.2
opencv-python>=4.5.1
Design
graph TD
A[Python library] --> B(Vearch-Plugin)
B --> c(Vearch)
c --> |response| B
Index service
Index service uses vearch for index image and generate an ID as bottle category.
Workflow:
Dependancies
- vearch base service for indexing images and categories
- vearch-python-plugin, wrapper for base API and used for python SDK
- vearch Python SDK
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for differnet_zerobox-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ab5271bc1dd552a36bbf731ff9ba3a8d92c536768942cbe45d0d8aec44a5df1 |
|
MD5 | dd715d3d5eacaceace786f413002fdeb |
|
BLAKE2b-256 | 22c2c0d2f6d349785430f5711f248dc1f9f51dca11068fb6c2672434f0f4dfe7 |