Validation Of Machine Vision Algorithms.
1. Introduction
Validation of machine vision algorithms refers to the systematic process of establishing that computer-based vision systems consistently, accurately, and reliably perform their intended functions. These systems use cameras, image-processing software, artificial intelligence (AI), and machine-learning techniques to analyse visual information and make decisions.
In biotechnology, pharmaceuticals, medical-device manufacturing, laboratory testing, and biological research, machine vision algorithms are increasingly used for:
Detection of defects in pharmaceutical products.
Inspection of vaccine vials, labels, seals, and packaging.
Identification and counting of microbial colonies.
Analysis of cell morphology and tissue samples.
Monitoring of laboratory experiments.
Detection of contamination in biological manufacturing.
Automated examination of medical images.
Verification of manufacturing processes and product quality.
Validation is particularly important because an inaccurate algorithm may incorrectly approve defective pharmaceutical products, reject safe biological products, misidentify microorganisms, or generate unreliable diagnostic results.
Under Russian law, machine vision validation is connected with pharmaceutical quality requirements, technical regulation, medical-device regulation, personal-data protection, electronic records, product safety, and evidentiary reliability.
The central legal principle is that an organisation cannot treat an algorithm's output as automatically accurate merely because the software has passed technical testing. Its suitability must be demonstrated for the particular purpose, operating environment, data population, and consequences of its decisions.
2. Legal and Regulatory Framework in Russia
Several Russian legislative instruments are relevant to machine vision validation.
2.1 Federal Law No. 61-FZ of 12 April 2010 on Circulation of Medicines
The Federal Law on Circulation of Medicines establishes requirements governing the development, manufacture, quality control, distribution, and circulation of medicinal products.
Machine vision systems used in pharmaceutical production may perform functions such as:
Inspecting ampoules and vials.
Detecting foreign particles.
Checking tablet dimensions and appearance.
Verifying packaging and labelling.
Identifying defective pharmaceutical products.
Where such systems form part of pharmaceutical quality-control operations, manufacturers must demonstrate that the relevant processes and equipment are suitable for their intended purposes.
An unvalidated inspection algorithm may create risks of releasing non-compliant medicinal products.
2.2 Federal Law No. 184-FZ on Technical Regulation
This legislation establishes the general framework for technical regulations, conformity assessment, and product safety.
Machine vision systems incorporated into regulated manufacturing equipment may be subject to applicable technical requirements.
The validation process should establish that the system operates consistently within the conditions for which it was designed.
2.3 Federal Law No. 102-FZ on Ensuring the Uniformity of Measurements
The law is relevant when machine vision systems perform measurements, including:
Measurement of tablet dimensions.
Measurement of biological structures.
Determination of particle size.
Measurement of cell populations.
Quantification of visible contamination.
If a machine vision system performs measurements falling within legally regulated measurement activities, applicable metrological requirements must be considered.
Not every image-classification algorithm is automatically a measuring instrument. Its legal status depends on its actual function and intended use.
2.4 Federal Law No. 152-FZ on Personal Data
Machine vision algorithms may process identifiable images of patients, research participants, employees, or clinical-trial subjects.
Where images constitute personal data, organisations must comply with requirements concerning:
Lawful processing.
Purpose limitation.
Data minimisation.
Security.
Access controls.
Retention.
Appropriate legal grounds for processing.
Images containing biometric personal data may attract additional requirements under Article 11.
2.5 Federal Law No. 323-FZ on the Fundamentals of Health Protection
This law is relevant where machine vision algorithms are used in medical diagnosis, treatment, or healthcare decision-making.
For example, algorithms analysing radiological images, histological slides, or ophthalmological images may influence medical decisions.
Their use must be assessed in connection with applicable medical-device requirements, professional responsibilities, and patient safety.
2.6 EAEU Medical-Device and Pharmaceutical Requirements
Russia also operates within the Eurasian Economic Union regulatory framework.
Relevant instruments include:
EAEU Council Decision No. 46 of 12 February 2016 concerning the rules for registration and examination of medical devices.
EAEU Council Decision No. 27 of 12 February 2016 concerning general safety and effectiveness requirements for medical devices.
EAEU pharmaceutical Good Manufacturing Practice requirements under EAEU Council Decision No. 77 of 3 November 2016.
These requirements are important where machine vision forms part of a regulated medical device or pharmaceutical manufacturing quality system.
3. Meaning and Scope of Machine Vision Algorithm Validation
Machine vision validation is more extensive than ordinary software testing. It evaluates the complete interaction between imaging hardware, image-processing software, algorithmic models, databases, operators, and the regulated production environment.
The principal components are:
| Component | Validation objective |
|---|---|
| Camera system | Confirm image acquisition reliability |
| Lighting system | Ensure consistent illumination |
| Image-processing software | Verify correct image processing |
| AI classification model | Establish classification accuracy |
| Object-detection algorithm | Confirm reliable detection |
| Training dataset | Establish representativeness and quality |
| Reference database | Ensure accuracy of comparison data |
| Decision-making system | Verify correct acceptance and rejection |
| Audit trail | Preserve traceability of decisions |
3.1 Accuracy Validation
Accuracy validation establishes whether the algorithm produces correct results when compared with an independently established reference standard.
For example, a pharmaceutical inspection algorithm may classify vials into:
Acceptable products.
Products containing visible particles.
Products with defective seals.
Products with damaged labels.
Products with cracks or structural defects.
The results should be compared against appropriately labelled reference images examined by qualified human inspectors or another scientifically justified reference method.
3.2 Precision and Recall
Two important performance measures are precision and recall.
Precision measures the proportion of positive detections that are correct.
\[ Precision=\frac{TP}{TP+FP} \]
Recall measures the proportion of actual defects that are detected.
\[ Recall=\frac{TP}{TP+FN} \]
Where:
TP = True positives.
FP = False positives.
FN = False negatives.
In pharmaceutical inspection, false negatives can be particularly dangerous because defective products may be incorrectly approved.
3.3 Specificity and Sensitivity
Sensitivity measures the ability to identify actual defects or relevant conditions.
Specificity measures the ability to correctly identify non-defective products.
Both measurements should be established using predefined acceptance criteria appropriate to the intended application.
A system designed to detect dangerous contamination may require substantially stricter performance requirements than a system used for non-critical packaging classification.
3.4 Repeatability and Reproducibility
Validation should demonstrate that the algorithm produces sufficiently consistent results when:
The same image is analysed repeatedly.
Different cameras are used.
Lighting conditions vary within approved limits.
Different operators conduct the inspection.
The system operates at different production speeds.
The algorithm is deployed on different qualified hardware.
3.5 Robustness Validation
Robustness validation determines whether the algorithm remains reliable when exposed to reasonably foreseeable variations.
Examples include:
Changes in lighting.
Camera positioning variations.
Image noise.
Slight differences in product orientation.
Differences in packaging materials.
Background interference.
Minor image distortions.
An algorithm that performs accurately only under ideal laboratory conditions may not be suitable for actual industrial use.
4. Legal Requirements for Validation Under Russian Pharmaceutical Manufacturing Law
4.1 EAEU GMP Requirements
One of the most important regulatory provisions is Section 5.4 of the EAEU Good Manufacturing Practice Rules, approved by EAEU Council Decision No. 77 of 3 November 2016.
Paragraph 5.40 requires GMP-related computerised systems to undergo validation. The extent of validation depends on their complexity, diversity, and criticality.
Paragraph 5.41 requires installation and operational qualification to demonstrate the suitability of computer hardware and software.
Paragraphs 5.43–5.48 address matters including:
Prevention of unauthorised access.
Protection against alteration or loss of data.
Written operating and maintenance procedures.
Investigation of system failures.
Authorisation and documentation of changes.
Testing of modified systems.
Backup and data protection.
These provisions are particularly important when machine vision algorithms control critical pharmaceutical inspection processes.
Контур.Экстерн+1
4.2 Installation Qualification (IQ)
Installation Qualification confirms that the machine vision system has been correctly installed.
It should cover:
Camera installation.
Lighting equipment.
Computer hardware.
Software installation.
Network connections.
Database configuration.
Operating environment.
Equipment identification.
4.3 Operational Qualification (OQ)
Operational Qualification demonstrates that the system functions correctly throughout its specified operating range.
For example, testing may examine whether the algorithm detects defects when lighting intensity changes within the approved limits.
4.4 Performance Qualification (PQ)
Performance Qualification demonstrates that the machine vision system performs consistently under actual production conditions.
It should use representative products, manufacturing conditions, inspection speeds, and defect categories.
A successful laboratory demonstration alone is insufficient to establish reliable performance in commercial manufacturing.
5. Validation of Artificial Intelligence and Machine Learning Algorithms
Machine vision systems increasingly use deep learning, convolutional neural networks, and other machine-learning techniques.
These algorithms create additional regulatory difficulties because their performance depends on training data, model architecture, and deployment conditions.
5.1 Training Dataset Validation
The training dataset should be:
Relevant to the intended application.
Sufficiently representative.
Properly labelled.
Free from unacceptable duplication.
Appropriately documented.
Reviewed for systematic bias.
For example, an algorithm trained primarily on clear glass vials may perform poorly when inspecting amber-coloured pharmaceutical containers.
5.2 Independent Test Dataset
The dataset used for final performance evaluation should be independent of the training dataset.
Otherwise, the algorithm may appear accurate because it has effectively memorised the training examples.
5.3 Overfitting and Underfitting
Overfitting occurs when a model performs well on training data but poorly on previously unseen images.
Underfitting occurs when the model is too limited to identify relevant patterns reliably.
Both situations may undermine regulatory confidence in the algorithm.
5.4 Model Drift
Model drift occurs when the algorithm's performance deteriorates because actual operating conditions or input data change over time.
Possible causes include:
New packaging designs.
Changes in raw materials.
Different camera equipment.
Changes in lighting.
New defect types.
Changes in manufacturing conditions.
Manufacturers should establish monitoring procedures and predefined criteria for reassessment, retraining, and revalidation.
5.5 Explainability and Traceability
For critical decisions, the manufacturer should preserve sufficient information to reconstruct:
Which image was analysed.
Which algorithm version was used.
What result was generated.
Which acceptance criteria applied.
Whether an operator overrode the result.
Whether the system had undergone an approved update.
The ability to reconstruct the decision is important for regulatory inspections, product recalls, investigations, and litigation.
6. Validation of Machine Vision in Medical Devices
Machine vision algorithms may constitute part of a medical device or medical-device software.
Examples include:
Radiological image analysis.
Histopathological image classification.
Retinal image assessment.
Automated cell counting.
Identification of abnormalities in medical images.
Under Federal Law No. 323-FZ and the applicable EAEU medical-device regulatory framework, the classification, registration, safety, and effectiveness requirements must be considered.
Where the algorithm qualifies as medical-device software, its registration and conformity assessment cannot be replaced by an internal validation report.
Russia's Ministry of Health Order No. 206n of 20 March 2020, as amended by Order No. 386n of 22 April 2021, is also relevant to the examination of medical-device documentation, including software using AI technologies.
imdrf.org
7. Case Laws Relating to Machine Vision and Algorithm Validation
There is an important distinction between direct judicial decisions concerning pharmaceutical machine vision validation and judgments concerning the reliability, legality, and use of algorithmic visual identification.
There is no established, widely reported Russian Supreme Court judgment specifically prescribing validation criteria for AI-based pharmaceutical machine vision algorithms. However, several judicial authorities provide relevant principles.
7.1 Glukhin v. Russia (2023)
European Court of Human Rights · Application No. 11519/20 · Judgment of 4 July 2023
Facts:
The case concerned the use of facial-recognition technology by Moscow authorities to identify and locate an individual who had participated in a peaceful demonstration.
The authorities used photographs, video footage, and facial-recognition technology in the identification process.
Legal issues:
Processing of biometric personal data.
Legality of facial-recognition technology.
Adequacy of safeguards.
Protection against arbitrary algorithmic surveillance.
Compliance with Article 8 of the European Convention on Human Rights.
Decision:
The European Court of Human Rights found violations of Articles 8 and 10 of the Convention.
It considered the processing of biometric information through facial-recognition technology particularly intrusive and insufficiently justified in the circumstances.
Relevance to machine vision validation:
This judgment illustrates that technical capability does not automatically establish legal acceptability.
A machine vision system must also operate within appropriate legal safeguards, particularly when processing biometric information.
It provides useful principles concerning transparency, accountability, and the documentation of algorithmic operations.
hudoc.echr.coe.int+1
Russian legal significance: The judgment is an important historical European human-rights authority concerning Russia. However, Russia ceased to be a party to the European Convention on Human Rights on 16 September 2022. The judgment should not be presented as a currently binding treaty obligation on Russia for post-withdrawal conduct.
7.2 Popova and Milov v. Moscow Department of Information Technologies (2020)
Moscow court proceedings · Reported decision of 3 March 2020
Facts:
The claimants challenged Moscow's facial-recognition surveillance system and sought restrictions on its use at public events and demonstrations.
The dispute concerned the legality of deploying facial-recognition technology in public surveillance.
Legal issue:
Whether the city's use of facial-recognition technology violated citizens' privacy rights.
Outcome:
According to contemporary Reuters reporting, the Moscow court rejected the challenge.
Relevance:
Although this proceeding did not concern pharmaceutical machine vision, it demonstrates the importance of examining the legal basis and safeguards surrounding automated image identification.
It also illustrates the distinction between technical functionality and the legal acceptability of deploying an algorithm in a particular context.
Investing.com Canada
7.3 Glukhin Case: Evidentiary Transparency and Algorithmic Accountability
A further important aspect of Glukhin is the difficulty of establishing whether facial-recognition technology was actually used.
The Court considered the absence of an official record of the technology's use and the difficulty faced by the applicant in proving the processing of his biometric data.
Application to pharmaceutical validation:
A pharmaceutical manufacturer should maintain records identifying:
The algorithm used.
The software version.
The image-processing parameters.
The inspection result.
The relevant reference standards.
Any manual intervention.
The date and time of inspection.
The broader lesson is that an algorithmic decision should be capable of independent examination.
7.4 Article 71 of the Russian Arbitration Procedure Code
Article 71 of Federal Law No. 95-FZ of 24 July 2002 establishes the principles governing judicial evaluation of evidence.
It requires arbitration courts to examine evidence comprehensively and assess its relevance, admissibility, reliability, and relationship with other evidence.
No evidence has predetermined evidentiary value.
cdn.nestjs.wipolex.wji.prd.web1.wipo.int+1
Application:
Suppose a pharmaceutical manufacturer claims that its machine vision algorithm correctly detected all defective vaccine containers.
A court considering a product-liability dispute may examine:
Whether the algorithm was validated.
Whether the reference dataset was reliable.
Whether the camera was properly calibrated.
Whether the inspection records were authentic.
Whether the software had been modified.
Whether independent technical expertise supports the results.
The algorithm's output alone would not necessarily establish that the products complied with applicable quality requirements.
8. Documentation Required for Machine Vision Validation
A regulated organisation should maintain a comprehensive validation documentation system.
| Document | Purpose |
|---|---|
| Validation Master Plan | Overall validation strategy |
| User Requirements Specification | Defines intended functionality |
| Functional Specification | Describes system functions |
| Design Specification | Describes technical architecture |
| Risk Assessment | Identifies potential failures |
| Installation Qualification | Confirms correct installation |
| Operational Qualification | Verifies operational performance |
| Performance Qualification | Establishes real-world suitability |
| Dataset Validation Report | Documents dataset quality |
| Algorithm Validation Report | Records model performance |
| Change Control Records | Tracks approved modifications |
| Audit Trail Records | Preserves decision history |
| Periodic Review Report | Confirms continuing suitability |
The validation documentation should be sufficient to demonstrate that the system remains fit for its intended purpose.
9. Major Legal and Regulatory Challenges
9.1 Algorithmic Bias
An algorithm may perform differently across different products, materials, image qualities, or biological samples.
For example, a model trained on one category of cell images may incorrectly classify another category.
This can produce scientifically unreliable results and potentially compromise patient safety.
9.2 False Acceptance of Defective Products
A particularly serious problem arises when the algorithm incorrectly approves defective products.
Possible consequences include:
Release of contaminated pharmaceutical products.
Distribution of defective medical devices.
Failure to identify damaged vaccine containers.
Incorrect laboratory results.
Regulatory enforcement.
Manufacturers must establish appropriate safeguards for high-risk classification decisions.
9.3 Software Updates and Revalidation
Machine-learning algorithms may be modified through retraining, software updates, or changes in operating parameters.
Every material change should undergo documented assessment.
A change that affects the model's decision-making performance may require partial or complete revalidation.
9.4 Data Integrity
Machine vision systems may generate large quantities of images and inspection records.
Organisations must protect these records against:
Unauthorised alteration.
Accidental deletion.
Incomplete recording.
Unauthorised access.
Loss during data migration.
Undocumented software changes.
9.5 Supplier Accountability
Where an organisation purchases machine vision software from an external developer, contractual arrangements should identify responsibility for:
Software development.
Technical support.
Validation documentation.
Security updates.
Defect correction.
Change notifications.
Data protection.
However, outsourcing software development does not automatically remove the regulated manufacturer's responsibility for the quality of its manufacturing operations.
10. Liability for Failure to Validate Machine Vision Algorithms
Failure to validate machine vision systems may create several categories of legal liability.
| Legal framework | Potential consequence |
|---|---|
| Federal Law No. 61-FZ | Pharmaceutical regulatory enforcement |
| Federal Law No. 184-FZ | Technical conformity and product-safety consequences |
| Federal Law No. 323-FZ | Medical safety and healthcare-related liability |
| Federal Law No. 152-FZ | Personal-data violations |
| Civil Code of Russia | Compensation for damage and contractual liability |
| Administrative Offences Code | Administrative penalties where applicable |
| Criminal Code | Criminal liability where statutory elements are established |
10.1 Civil Liability
Under Articles 15 and 1064 of the Russian Civil Code, legally recoverable losses and compensation for damage may arise where the applicable conditions are satisfied.
For example, a manufacturer may face a claim where defective products entered circulation because its inspection system failed to identify visible contamination.
10.2 Administrative Liability
Depending on the circumstances, violations of mandatory pharmaceutical, product-safety, or personal-data requirements may attract administrative sanctions.
10.3 Criminal Liability
Where defective products cause serious harm, criminal liability may arise under applicable provisions of the Russian Criminal Code, depending on the conduct, consequences, causation, and required elements of the offence.
Software failure alone does not automatically establish criminal responsibility.
11. Practical Example: Validation of a Machine Vision System for Vaccine Vial Inspection
Consider a Russian pharmaceutical manufacturer using an AI-powered machine vision system to inspect vaccine vials.
Visual Inspection Automation for Pharmaceutical Vials & Ampoules | Qualitas App Note
Automated Visual Inspection » Syntegon
Plus 200 LKD Automatic Inspection | Stevanato Group
17
The system is designed to detect:
Glass cracks.
Foreign particles.
Incorrect labels.
Damaged seals.
Missing packaging components.
Step 1: Define intended use
The manufacturer establishes which defects the algorithm must detect and which products it is authorised to inspect.
Step 2: Establish reference data
Qualified inspectors prepare an independently reviewed dataset containing acceptable and defective vial images.
Step 3: Test algorithm accuracy
The manufacturer measures sensitivity, specificity, precision, recall, and false-negative rates.
Step 4: Conduct IQ, OQ, and PQ
The equipment is installed, operational parameters are tested, and actual production performance is evaluated.
Step 5: Establish acceptance criteria
The manufacturer defines acceptable performance levels based on product risk and regulatory requirements.
Step 6: Maintain human oversight
Uncertain or exceptional results are referred for additional examination under approved procedures.
Step 7: Maintain continuing validation
Changes to software, cameras, lighting, product design, or training datasets are assessed through formal change control.
Legal consequence: If a defective vial is released because the algorithm was inadequately validated, the manufacturer may face regulatory investigation and civil liability, depending on the circumstances.
12. Recommended Compliance Measures
Russian pharmaceutical and biotechnology organisations should adopt the following measures:
Prepare a written machine vision validation policy.
Classify systems according to product and patient-safety risks.
Establish documented acceptance criteria.
Use independent reference datasets.
Conduct IQ, OQ, and PQ.
Maintain complete software-version records.
Introduce role-based access controls.
Preserve original images and inspection results where required.
Establish procedures for model drift detection.
Conduct periodic performance reviews.
Require formal approval before algorithm modifications.
Investigate deviations and inspection failures.
Establish supplier quality agreements.
Maintain an appropriate human-review mechanism.
Ensure that the system remains in a validated state throughout its operational lifecycle.
13. Future Development of Machine Vision Regulation in Russia
Several developments are likely to influence the regulation of machine vision algorithms.
AI-based pharmaceutical quality control: Greater use of automated visual inspection may increase the importance of algorithm validation and data integrity.
Medical-device software: More sophisticated diagnostic algorithms will require careful evaluation of safety, effectiveness, and intended clinical use.
Biometric data protection: Facial and other biometric recognition systems will require appropriate legal safeguards.
Automated laboratory analysis: Machine vision may increasingly be used in cell counting, microbiology, tissue analysis, and biotechnology research.
Regulatory accountability: Regulators may place greater emphasis on explainability, reproducibility, model monitoring, and documented human oversight.
These developments should be understood as regulatory trends rather than as proof that Russia has already adopted a single comprehensive statutory validation framework specifically for machine vision algorithms.
14. Conclusion
Validation of machine vision algorithms is an essential component of modern pharmaceutical and biotechnology quality management in Russia.
The principal legal foundation for machine vision systems used in GMP-regulated manufacturing is the EAEU GMP framework, particularly Section 5.4 of EAEU Council Decision No. 77 of 3 November 2016.
Other relevant legislation includes Federal Laws Nos. 61-FZ, 102-FZ, 152-FZ, 184-FZ, and 323-FZ, depending on the system's intended purpose.
The Glukhin v. Russia judgment provides important principles concerning biometric image processing, safeguards, and algorithmic accountability. Article 71 of the Russian Arbitration Procedure Code provides a relevant framework for judicial examination of algorithm-generated evidence.
Ultimately, a machine vision algorithm must demonstrate accuracy, reliability, traceability, robustness, and continuing suitability. Its output should not be treated as conclusive proof of product quality without adequate validation and supporting evidence.
15. Important Legal References
| Legal authority | Relevance |
|---|---|
| Federal Law No. 61-FZ (2010) | Circulation of medicines |
| Federal Law No. 102-FZ (2008) | Measurement uniformity |
| Federal Law No. 152-FZ (2006) | Personal-data protection |
| Federal Law No. 184-FZ (2002) | Technical regulation |
| Federal Law No. 323-FZ (2011) | Health protection |
| Federal Law No. 95-FZ (2002) | Arbitration procedure |
| EAEU Council Decision No. 77 (2016) | Pharmaceutical GMP |
| EAEU Council Decision No. 27 (2016) | Medical-device safety and effectiveness |
| EAEU Council Decision No. 46 (2016) | Medical-device registration |
| Ministry of Health Order No. 206n (2020) | Medical-device examination |
| Ministry of Health Order No. 386n (2021) | Amendments concerning medical-device examination |
| Glukhin v. Russia (2023) | Facial recognition and biometric safeguards |
Research qualification: The case-law discussion distinguishes direct judicial authority from analogous decisions. No specific reported Russian judgment establishing a mandatory numerical accuracy threshold for pharmaceutical machine vision algorithms has been identified. Such thresholds must therefore be determined through the applicable regulatory requirements, intended use, scientific evidence, and documented risk assessment.
For a legally defensible validation programme, the manufacturer should rely on the current consolidated versions of the applicable EAEU and Russian legislation.
The EAEU GMP requirements can be consulted through EAEU Council Decision No. 77 and the full judgment in Glukhin v. Russia.

comments