This code is for Intelligent Industrial Vision System for Defect Detection.
If you would like to adopt this project and then redevelop for yours, you are supposed to possess qualified skills by self-education or specialized courses. Here is a list of skills for consideration.
- Competent to read development documents in English;
- Command general knowledge about database and website;
- Familiar with HTML5, CSS & JavaScript;
- Expert at Python Web Tech (Django or Flask).
The front-end templates are supported by CoreUI and Vvveb and based on BootstrapJS.
Reference | Link |
---|---|
The Business Website | Github - Vvveb Bootstrap5 Template & UI Kit |
The Dashboard | Github - CoreUI Free Bootstrap Admin Template CoreUI Development Document |
Free Illustrations | Freepik |
Online Translating Service | translate.js |
Data Visualization | chart.js |
Environment | Content |
---|---|
Front-End | CoreUI(Bootstrap Template) v2.1.2 |
Back-End | Django v4.1.12 |
Database Deployment | PostgreSQL(Docker) Milvus Standalone in Docker(Seldom Used) |
Browsers for testing | Chrome/Microsoft Edge |
IDE or Tools | PyCharm CE Chrome DevTools |
├ ─ core # models saved
│ ├ ─ core # Core components
│ │ ├ ─ settings.py # Global settings
│ │ ├ ─ urls.py # Global urls
│ │ └ ─ ...
│ ├ ─ detection # App for dashboard
│ │ ├ ─ migrations* # Generated by cmd
│ │ ├ ─ static* # Generated by cmd
│ │ ├ ─ apps.py # App info
│ │ ├ ─ urls.py # Urls
│ │ ├ ─ views.py # Views functions
│ │ ├ ─ models.py # Associated with database
│ │ ├ ─ detecting.py # Run detecting
│ │ └ ─ ...
│ ├ ─ home # App for business Website
│ │ └ ─ ...
│ ├ ─ templates # Templates
│ │ ├ ─ detecting.py # Run detecting
│ │ └ ─ ...
│ ├ ─ static # Static files
│ ├ ─ staticfiles # Useless, but do not delete
│ ├ ─ media # Upload files
│ ├ ─ manage.py # Project initiation
│ ├ ─ main.py # Fast preject initiation
│ └ ─ __inin__.py
├── requirements.txt
└── README.md
-
Use Python virtual environment or Conda environment.
Note that Conda environment are not easily switched by windows commands. (I failed to do it.)
-
Install the requirements.txt for required Python library like Django or protobuf.
If you want to visit MySQL, please install pymysql or mysqlclient. If you would like use PostgreSQL, please install psycopg2.
-
- First, establish a database locally or remotely. (Recommend pirated Navicat for management and Docker for deployment.)
- Edit "detection/models.py" for ORM(Object-Relational Mapping).
- Run
python manage.py makemigrations
to record the changes locally in "core/detection/migrations". - Run
python manage.py migrate
to commit changes into your database. - Reset DATABASES in settings.py.
- Run and debug.
-
It's a very complicated work actually, but almost everything has been done.
-
After set DEBUG=False, please run the command:
python manage.py collectstatic
-
Debug for any possible bugs.
-
-
- Reset MEDIA_URL and MEDIA_ROOT. Determine the storage path for uploaded images.
- Debug for any possible bugs.
-
- Reset TEMPLATES in settings.py for any changes.
- All web pages in "core/templates/" are inherited from the skeleton templates and based on Django template language.
- Check it for more information: Django-Template-en or Django-Template-zh
Please take it as reference: STFPM_AnomalyDetection
-
Generally, the dashboard system is divided into four modules: Production, Model, Data and Report.
- For the production module, the program on the full process of management and approval of working sheets has not yet completed.
- For the model module, the Backlog includes two aspects, one is to expand the additional models for detection, the other is to Invoke the model prediction programs from the outside with different virtual environments or remote API.
- For the data module and the report module, the data retrieval service and report conclusion service is not well-prepared.
-
When a user visit a specific URL, the corresponding views function with be executed to render the page. However, the realization code is so confusing to understand or maintain that code refactoring is required. For example, some back-end computing processing is mixed with template rendering in one view function, which can be separated.
-
This part is on the Model module. Check it in the model function in "/detection/views.py".
- The API in the code is not specific to image processing. An independent API is needed here.
- Temporarily, the prediction program support batch work, but the API is able to process one image at a time.
-
Detecting Data should be further recorded and managed in way of RMDB or Milvus. Detecting data means the information of operations In RMDB, while it also means the feature vectors of the prediction in Milvus.
-
This code is lack of validation set.
The test set comes from the MVTec Dataset merely containing standard images. Although we practised some field test on embedded end (controlling a robotic arm to classify objects), the real-time test data was not recorded.