Sea lice and parasite underwater image AI · Fish mortality and welfare AI · Fish counter and biomass AI · Harvested fish grading AI

Prompt injection in aquaculture and fisheries AI

Aquaculture and fisheries AI has become the operational core of sea lice treatment threshold compliance, fish welfare monitoring, biomass quota management, and harvest quality certification across the global salmon and finfish aquaculture industry at a scale that concentrates Norwegian Aquaculture Act regulatory compliance, fish health veterinary treatment authorisation, Norwegian Directorate of Fisheries biomass quota enforcement, and EU fish market standard grade certification decision-making in AI systems that process untrusted underwater and above-water image inputs at every stage of the production cycle: Aquabyte AI deploys sea lice and salmon welfare monitoring at SalMar, Mowi (Marine Harvest), Grieg Seafood, Cooke Aquaculture, and other major Norwegian and North Atlantic salmon farming operators — processing underwater camera images of individual salmon in net pen environments through AI-assisted sea lice count estimation, wound severity scoring, and salmon welfare assessment tools that determine whether Norwegian Aquaculture Act §25 fish welfare obligations are being met, whether Norwegian Medicines Act sea lice treatment thresholds have been exceeded requiring veterinary-authorised antiparasitic treatment, and whether Aquaculture Stewardship Council (ASC) sea lice indicator thresholds require audit-reportable corrective action; ViAqua AI processes fish health monitoring data and underwater observation images through AI-assisted fish health status classification, disease indicator detection, and welfare scoring tools at Atlantic salmon and rainbow trout aquaculture sites in Norway, Scotland, Chile, and Canada, with AI outputs informing veterinary treatment decisions under Norwegian Medicines Act and equivalent national veterinary medicines frameworks; Innovasea AI deploys underwater fish monitoring systems and VAKI fish counter technology at salmon and finfish aquaculture sites globally, processing underwater camera frames and fish counter sensor images through AI-assisted fish counting, individual fish biometric measurement, and biomass estimation tools that aquaculture operators depend upon for Norwegian Directorate of Fisheries biomass quota compliance reporting and fishing licence condition adherence monitoring; Observe Technologies AI deploys salmon feeding and welfare monitoring AI at Marine Harvest (now Mowi), SalMar, and Cermaq project sites, processing overhead and underwater observation camera images of salmon feeding behaviour, schooling pattern density, and surface behaviour anomaly indicators through AI-assisted salmon welfare scoring and feeding efficiency optimisation tools with Norwegian Aquaculture Act §10 operational standards and ASC aquaculture certification welfare indicator obligations; AquaCloud AI deploys Norwegian salmon farming data infrastructure with AI-assisted sea lice count aggregation, lice treatment record keeping, and biomass reporting tools; iFarm AI processes fish welfare monitoring images through AI-assisted welfare indicator classification tools at Cargill-partnership aquaculture operations; and BioSort AI and Marel AI deploy fish grading and sorting systems that process harvested salmon, trout, and white fish images through AI-assisted quality grade classification, defect detection, and EU Regulation 1379/2013 market standard compliance scoring tools used by Norwegian and European seafood exporters for Grade A and Grade B product segregation, export certificate issuance, and buyer contract grade warranty compliance documentation. Each of these aquaculture and fisheries AI platforms shares a structural vulnerability that creates adversarial image injection exposure with direct Norwegian regulatory compliance, veterinary treatment accountability, biomass quota management, and EU export market consequences: they depend on underwater parasite and welfare images, fish counter sensor frames, and harvest quality photographs that pass through AI processing layers before their output governs treatment threshold determinations, quota compliance reports, and export grade certifications — and they operate under regulatory frameworks where AI output manipulation creates Norwegian Aquaculture Act welfare violation exposure, Norwegian Medicines Act veterinary treatment accountability failures, Norwegian Directorate of Fisheries quota fraud consequences, and EU Regulation 1379/2013 market standard certification violations of substantial regulatory and commercial severity.

TL;DR

Aquaculture and fisheries AI platforms — Aquabyte AI, ViAqua AI, Innovasea AI, Observe Technologies AI, AquaCloud AI, iFarm AI, BioSort AI, Marel AI — process sea lice and parasite underwater salmon images, fish mortality and behavioural welfare photographs, fish counter and biomass estimation frames, and harvested fish grading images through AI-assisted sea lice count estimation, fish welfare scoring, biomass quota compliance reporting, and EU market standard grade classification pipelines. Adversarially crafted images submitted through Aquabyte or ViAqua underwater sea lice monitoring camera integrations, Observe Technologies or iFarm behavioural welfare monitoring channels, InnovaSea VAKI fish counter sensor interfaces, and BioSort or Marel fish grading systems can cause AI systems to suppress sea lice count exceedances that would require Norwegian Medicines Act veterinary treatment authorisation, conceal crowding stress or abnormal swim pattern indicators triggering Norwegian Aquaculture Act welfare obligations, overstate biomass quota compliance by manipulating fish counter frame classifications, and mask EU Regulation 1379/2013 Grade B quality defects in harvest grading determinations — triggering Norwegian Aquaculture Act §25 welfare violation fines, Norwegian Medicines Act treatment threshold accountability failures, Norwegian Directorate of Fisheries quota fraud enforcement, and ASC aquaculture certification suspension consequences. Glyphward scans each image at the ingestion boundary with a threshold of ≥ 55 for sea lice underwater imaging AI and fish counter biomass AI, ≥ 60 for fish welfare monitoring AI, and ≥ 65 for harvested fish grading AI. Free tier — 10 scans/day, no card required.

Four adversarial injection surfaces in aquaculture and fisheries AI

1. Sea lice and parasite underwater image injection (Aquabyte AI, ViAqua AI)

Sea lice and parasite underwater image AI processes stereo underwater camera images captured by Aquabyte AI’s net pen-mounted camera systems at SalMar, Mowi, and Grieg Seafood salmon farming sites, ViAqua AI underwater observation cameras at Atlantic salmon aquaculture sites in Norway, Scotland, Chile, and Canada, and other net pen underwater monitoring camera systems that extract per-fish sea lice count estimates — mobile lice (Lepeophtheirus salmonis), stationary lice, pre-adult lice, adult female lice counts — and wound severity scores from underwater salmon stereo image inputs, generating per-pen sea lice mean count estimates, treatment threshold exceedance flags, veterinary treatment action recommendations, and ASC Aquaculture Stewardship Council welfare indicator reporting entries that Norwegian salmon farming operators depend upon for Norwegian Aquaculture Act §25 fish welfare and Norwegian Medicines Act sea lice treatment threshold compliance under the Norwegian Food Safety Authority and Norwegian Directorate of Fisheries regulatory framework. Aquabyte AI has deployed sea lice counting AI at the world’s largest salmon farming operators — including Mowi (formerly Marine Harvest, the world’s largest salmon farmer), SalMar, and Grieg Seafood — with AI-generated sea lice count outputs directly informing veterinary surgeon authorised antiparasitic treatment decisions under the Norwegian Medicines Act treatment threshold framework that applies at 0.5 adult female lice per fish mean count in the treatment obligation-triggering regulatory period. ViAqua AI processes fish health monitoring images and underwater observation data through AI-assisted fish health status classification and sea lice monitoring tools at aquaculture sites under multiple national veterinary medicines and fish welfare regulatory frameworks, with AI health status outputs informing veterinary treatment decisions that require regulatory compliance with national fish health monitoring and disease control frameworks.

The adversarial injection surface is the underwater sea lice counting camera image submission pathway: Aquabyte AI stereo underwater camera images and ViAqua AI underwater monitoring images submitted through AI-assisted sea lice count estimation and treatment threshold exceedance detection tools for AI per-fish lice count classification, mobile/adult female lice species discrimination, and Norwegian Aquaculture Act treatment threshold scoring. An adversarially crafted Aquabyte AI underwater stereo camera image — in which pixel perturbations applied to the adult female sea lice visual identification region, the mobile lice attachment point indicator, or the wound severity erosion marker on the dorsal surface of individual salmon in an underwater stereo camera capture cause the AI to classify a salmon pen with a mean sea lice count exceeding the Norwegian Medicines Act treatment threshold as below-threshold no-treatment-required standard welfare conditions when the actual image documents a sea lice burden meeting the veterinary treatment authorisation trigger — can suppress a treatment threshold exceedance flag that would otherwise generate a veterinary surgeon treatment recommendation and a Norwegian Aquaculture Act §25 welfare monitoring corrective action record. In Norwegian salmon farming operations where Aquabyte AI sea lice counting generates the weekly lice count data that farm veterinarians use to assess treatment obligation under the Norwegian Medicines Act, adversarial suppression of treatment threshold exceedance flags enables sea lice burdens above the treatment threshold to persist without veterinary treatment, with regulatory compliance consequences under both the Norwegian Aquaculture Act fish welfare standards and the Norwegian Medicines Act antiparasitic treatment regulatory framework.

The regulatory consequences of adversarially suppressed sea lice treatment threshold exceedance detection span Norwegian Aquaculture Act §25, Norwegian Medicines Act treatment accountability, ASC aquaculture certification, and neighbouring-farm sea lice load-sharing dimensions. Norwegian Aquaculture Act §25 (Fish Welfare) requires aquaculture operators to ensure that fish are kept in a manner that promotes their natural behaviour and wellbeing and that prevents unnecessary suffering; sea lice burdens above treatment thresholds that persist without veterinary treatment constitute a §25 fish welfare violation with Norwegian Food Safety Authority (Mattilsynet) administrative enforcement consequences including welfare orders and financial penalties. Norwegian Medicines Act (Lov om legemidler) establishes the sea lice treatment threshold framework under which Norwegian salmon farmers are obligated to obtain veterinary surgeon authorisation for antiparasitic treatment when mean sea lice counts exceed defined thresholds per regulatory period; adversarial manipulation of Aquabyte AI sea lice count tools that suppresses treatment threshold exceedance flags creates an accountability gap in the veterinary treatment obligation framework, with potential Medicines Act enforcement consequences for treatment threshold non-compliance and professional accountability dimensions for the veterinary surgeon whose treatment decisions are informed by AI-generated lice count data. ASC Aquaculture Stewardship Council Salmon Standard Criterion 5.1 specifies maximum acceptable sea lice infestation levels and requires certified operators to demonstrate compliance through independent monitoring; adversarial suppression of Aquabyte sea lice count AI that allows above-threshold burdens to go unrecorded creates an ASC audit compliance gap that threatens the operator’s ASC certification, which is a prerequisite for premium market access at major European and North American retailers who mandate ASC certification for their salmon procurement programmes. Threshold: 55 for sea lice underwater image AI — reflecting the Norwegian Aquaculture Act welfare, Norwegian Medicines Act treatment threshold, and ASC certification dimensions of suppressed sea lice count exceedance detection.

2. Fish mortality and behavioural welfare injection (Observe Technologies AI, iFarm AI)

Fish mortality and behavioural welfare AI processes overhead and underwater observation camera images from Observe Technologies AI systems deployed at Mowi, SalMar, and Cermaq salmon farming sites, iFarm AI fish welfare monitoring systems at Cargill-partnership aquaculture operations, and AquaCloud AI Norwegian salmon farming data platform welfare indicator monitoring tools, extracting schooling pattern density scores, surface behaviour anomaly classifications, crowding stress indicator identifications, abnormal swim pattern flags, and dead fish accumulation detection events from salmon behavioural observation image inputs, generating Norwegian Aquaculture Act §10 operational standard compliance scores, fish welfare indicator reports, feeding efficiency recommendations, and ASC Salmon Standard welfare certification audit entries that salmon farming operators use for regulatory compliance documentation, operational farm management decisions, and ASC certification maintenance. Observe Technologies AI processes overhead camera images of salmon pen surface behaviour at high-resolution to identify feeding response intensity, schooling density anomalies indicating crowding stress or hypoxia, surface dwelling behaviour patterns indicating oxygen depletion or gill health concerns, and dead fish flotation events requiring mortality removal from pen environments under Norwegian Aquaculture Act operational standards; its AI welfare indicator outputs are used by Mowi and SalMar farm management teams for daily welfare monitoring report preparation under Norwegian regulatory reporting obligations. iFarm AI processes fish welfare monitoring images at Cargill Aqua Nutrition-affiliated aquaculture operations, with AI-assisted welfare indicator classification tools generating welfare scoring data used for ASC certification audit compliance and operational farm management purposes.

The adversarial injection surface is the overhead and underwater behavioural welfare monitoring image submission pathway: Observe Technologies AI overhead camera images and iFarm AI welfare monitoring images submitted through AI-assisted crowding stress detection, abnormal swim pattern classification, and Norwegian Aquaculture Act §10 operational standard compliance scoring tools. An adversarially crafted Observe Technologies AI overhead salmon pen observation image — in which pixel perturbations applied to the schooling density gradient indicator, the abnormal swim trajectory visualisation region, or the surface-dwelling crowding stress pattern marker in an overhead pen observation image cause the AI to classify a salmon pen exhibiting crowding stress, hypoxia-associated surface dwelling behaviour, or abnormal swim pattern indicators as displaying normal healthy schooling behaviour when the actual image documents welfare indicator anomalies meeting Norwegian Aquaculture Act §10 operational standard intervention criteria — can suppress a welfare monitoring intervention flag that would otherwise generate a farm management corrective action record and a Norwegian regulatory reporting entry. In high-density salmon farming operations where Observe Technologies AI processes continuous overhead camera footage from multiple active salmon pens, adversarial suppression of crowding stress or abnormal swim pattern classifications allows welfare-compromised pen conditions to persist without the operational intervention and regulatory documentation that Norwegian Aquaculture Act §10 requires.

The regulatory consequences of adversarially suppressed fish welfare indicator detection span Norwegian Aquaculture Act §10 operational standards, ASC Salmon Standard welfare criteria, and operational farming risk management dimensions. Norwegian Aquaculture Act §10 requires aquaculture operators to maintain operational standards that prevent fish welfare compromise from overcrowding, oxygen depletion, disease outbreaks, and other identifiable welfare risks; adversarial manipulation of Observe Technologies AI or iFarm AI welfare monitoring tools that suppresses crowding stress or abnormal swim pattern indicators creates a §10 operational standard compliance gap with Mattilsynet enforcement consequences. ASC Salmon Standard Criterion 6.3 requires certified operators to demonstrate that stocking densities, feeding practices, and pen management protocols do not cause welfare-indicator anomalies above ASC threshold levels; adversarial suppression of welfare monitoring AI that allows above-threshold welfare indicator events to go unrecorded creates an ASC audit documentation gap that can result in corrective action requirements or certification suspension at the annual ASC audit. Norwegian salmon farming operational risk management is also directly affected: crowding stress and oxygen depletion events that proceed without AI-flagged intervention escalate into mass mortality events that can result in the loss of hundreds of thousands of fish with direct production loss and insurance claim consequences. Threshold: 60 for fish mortality and behavioural welfare AI — reflecting the Norwegian Aquaculture Act §10 operational standards, ASC welfare certification, and production loss risk dimensions of suppressed welfare indicator detection.

3. Fish counter and biomass injection (InnovaSea VAKI AI, AquaCloud AI)

Fish counter and biomass AI processes individual fish detection frames from InnovaSea VAKI AI optical counter sensor images at salmon smolt transfer, harvest, and net pen movement events, AquaCloud AI Norwegian salmon farming biomass data platform inputs, and integrated aquaculture management platform biomass monitoring display screenshots, extracting individual fish count values, per-fish weight estimates from optical biometric measurements, aggregate biomass calculation inputs, and Norwegian Directorate of Fisheries biomass quota compliance status assessments from fish counter image inputs, generating monthly biomass reporting data, fishing licence condition adherence confirmations, and Norwegian Directorate of Fisheries quota compliance declarations that Norwegian salmon farming operators depend upon for production licence biomass cap compliance under the Norwegian Directorate of Fisheries aquaculture regulation framework. InnovaSea VAKI fish counter technology is deployed as the industry-standard optical counting system for Norwegian and international salmon aquaculture biomass monitoring at smolt transfer events, net pen split and merge operations, and harvest events, with VAKI optical counter sensor images processed by AI-assisted fish count and individual weight estimation tools whose outputs directly feed into the monthly biomass reports that Norwegian salmon farmers submit to the Norwegian Directorate of Fisheries under their production licence conditions. AquaCloud AI operates a Norwegian salmon farming data infrastructure platform that aggregates sea lice count records, biomass data, treatment records, and lice zone compliance reporting from participating Norwegian salmon farming operators, with AI-assisted data processing and compliance status tools whose outputs inform Norwegian Directorate of Fisheries regional lice zone compliance assessments.

The adversarial injection surface is the VAKI fish counter optical sensor image submission pathway: InnovaSea VAKI optical counter sensor images and AquaCloud AI biomass display screenshots submitted through AI-assisted fish count estimation, per-fish weight biometric measurement, and Norwegian Directorate of Fisheries quota compliance assessment tools. An adversarially crafted InnovaSea VAKI optical counter sensor image — in which pixel perturbations applied to the individual fish body outline detection region, the fish size biometric measurement reference point indicator, or the count threshold crossing event marker in a VAKI optical sensor frame cause the AI to undercount the number of fish or overestimate individual fish mean weight in a biomass estimation event, generating an inflated biomass-per-fish calculation that causes the AI to report a biomass count below the Norwegian Directorate of Fisheries production licence cap when the actual fish counter data documents biomass at or above the regulatory cap — can suppress a quota exceedance flag that would otherwise generate a production licence compliance deficiency report. Norwegian salmon farming production licences specify maximum allowable biomass (MAB) caps per site in metric tonnes of live fish; adversarial manipulation of VAKI AI fish counter and biomass estimation tools that causes systematic underreporting of per-pen biomass against the MAB cap creates a Norwegian Directorate of Fisheries quota compliance reporting violation with production licence enforcement consequences.

The regulatory and enforcement consequences of adversarially inflated biomass reporting in fish counter AI span Norwegian Directorate of Fisheries production licence enforcement, fishing licence condition compliance, and quota fraud criminal liability dimensions. Norwegian Directorate of Fisheries (Fiskeridirektoratet) enforces production licence MAB caps for Norwegian salmon farming sites under the Norwegian Aquaculture Act and the Directorate’s site-licence regulatory framework; adversarial manipulation of VAKI fish counter AI that causes systematic biomass underreporting against the MAB cap creates a site-licence non-compliance with Directorate enforcement authority including production stop orders, administrative sanctions, and production licence revocation consequences. Norwegian fishing licence conditions for salmon aquaculture sites specify biomass caps as a binding condition of licence; adversarial manipulation that enables production above the licensed biomass cap while reporting compliance constitutes a licence condition violation with Norwegian Penal Code fraud exposure in addition to administrative enforcement. The economic consequences of biomass quota manipulation at Norwegian salmon farming scale — where MAB caps represent annual production value of tens to hundreds of millions of Norwegian kroner per site licence — create strong adversarial incentive for competitors, disgruntled employees, or external actors to deploy adversarial VAKI sensor image manipulation to compromise a farming operator’s quota compliance reporting. Threshold: 60 for fish counter and biomass AI — reflecting the Norwegian Directorate of Fisheries MAB cap enforcement, production licence compliance, and quota fraud criminal liability dimensions of suppressed biomass count accuracy.

4. Harvested fish grading photograph injection (BioSort AI, Marel AI)

Harvested fish grading AI processes photographs of harvested Atlantic salmon, rainbow trout, and white fish products submitted through BioSort AI fish grading and sorting systems at Norwegian and Scottish seafood processing facilities, Marel AI fish processing and grading platforms at seafood processing establishments across more than 100 countries, and integrated seafood processing management platform quality grading display screenshot images, extracting EU Regulation 1379/2013 market standard grade classifications — Grade A, Grade B, Grade C — product defect severity scores — bruising extent, wound classification, melanisation, cataracts, deformity indicators — and EU export certificate eligibility assessments from harvested fish product image inputs, generating EU market standard grade assignments, export certificate eligibility determinations, and buyer contract grade warranty compliance records that Norwegian and European seafood exporters depend upon for EU fish market standard compliance, export certificate issuance, and buyer contract grade warranty fulfilment under EU Regulation 1379/2013 (Common Market Organisation for Fishery and Aquaculture Products). BioSort AI deploys fish grading and sorting systems at Norwegian seafood processing facilities, with AI-assisted quality grade classification tools processing harvested salmon and trout product images at processing line speeds and generating Grade A and Grade B product segregation decisions that determine the price differential and buyer contract grade eligibility of the harvested product. Marel AI deploys fish processing and grading platforms at seafood processing establishments in Norway, Scotland, Canada, Chile, and globally, with AI-assisted product grading tools generating EU market standard grade assignments that seafood exporters use for export certificate applications and buyer contract grade warranty documentation.

The adversarial injection surface is the harvested fish product photograph submission pathway: harvested salmon, trout, and white fish product images submitted through BioSort AI grading systems or Marel AI processing platforms for AI EU Regulation 1379/2013 market standard grade classification, product defect severity scoring, and export certificate eligibility assessment. An adversarially crafted harvested salmon product photograph — in which pixel perturbations applied to the bruising extent visual indicator, the wound classification severity marker, or the melanisation pigmentation pattern in a harvested salmon quality inspection image cause the AI to classify a Grade B product with EU Regulation 1379/2013 market standard defects — bruising, wounding, melanisation, or deformity meeting Grade B quality indicator thresholds — as a Grade A premium market standard product when the actual image documents condition indicators meeting EU Regulation 1379/2013 Annex I Grade B classification criteria — can suppress a Grade B classification that would otherwise prevent the product from receiving a Grade A export certificate, segregate it from Grade A buyer contract consignments, and require pricing at the Grade B market price differential. In high-throughput seafood processing environments where BioSort AI or Marel AI grade classification tools process harvested fish images at processing line speeds without individual human quality grader inspection of each AI grade assignment, adversarial suppression of Grade B quality defect classifications allows Grade B-condition product to be shipped to export buyers under Grade A export certificates and buyer contract grade warranties that the product does not meet.

The regulatory and contractual consequences of adversarially suppressed EU market standard grade defect detection span EU Regulation 1379/2013 market standard violation, export certificate fraud, buyer contract grade warranty breach, and Norwegian export competency dimension. EU Regulation 1379/2013 on the common organisation of the markets in fishery and aquaculture products establishes freshness and size grade standards for aquaculture and wild capture fishery products marketed in the EU; adversarial manipulation of fish grading AI that causes Grade B products to be misclassified as Grade A creates an EU market standard violation with Norwegian Seafood Council (Norges sjømatråd) export authorisation consequences and EU member state food safety authority enforcement exposure at the import destination. Norwegian export certificate procedures require exporters to declare that products meet EU market standard requirements; adversarial AI grade manipulation that generates false Grade A certifications for Grade B products creates export documentation fraud exposure with Norwegian authorities. Buyer contract grade warranties in Norwegian salmon export contracts specify that delivered product will meet EU Regulation 1379/2013 Grade A market standard criteria; adversarial suppression of Grade B defect detection in AI grading systems that causes Grade B product to be shipped under Grade A warranties creates buyer contract breach claims with price adjustment, product return, and consequential damage exposure. The competitive economic incentive for adversarial fish grading AI manipulation at Norwegian salmon export scale — where Grade A to Grade B price differentials represent NOK 2-4 per kilogram across annual salmon export volumes of hundreds of thousands of tonnes — is substantial. Threshold: 65 for harvested fish grading AI — reflecting the EU Regulation 1379/2013 market standard, export certificate, buyer contract warranty, and competitive market integrity dimensions of suppressed harvest quality defect detection.

Integration: aquaculture and fisheries AI image ingestion with Glyphward pre-scan

Aquaculture and fisheries AI image ingestion flows from Aquabyte and ViAqua underwater sea lice counting camera APIs, Observe Technologies and iFarm behavioural welfare monitoring image channels, InnovaSea VAKI fish counter sensor interfaces, and BioSort and Marel fish grading system platforms into sea lice treatment threshold AI, fish welfare indicator scoring AI, biomass quota compliance reporting AI, and EU market standard grade classification AI pipelines. Insert Glyphward’s pre-scan at the ingestion boundary before AI-generated output is committed to Norwegian Aquaculture Act welfare compliance records, veterinary treatment threshold logs, Norwegian Directorate of Fisheries biomass quota reports, or EU export certificate grade declarations:

import asyncio
import base64
import hashlib
import os
import uuid
from enum import Enum
from pathlib import Path

import httpx

GLYPHWARD_API_KEY = os.environ["GLYPHWARD_API_KEY"]
GLYPHWARD_SCAN_URL = "https://glyphward.com/v1/scan"

# Aquaculture & fisheries AI — Norwegian Aquaculture Act §§10/25;
# Norwegian Medicines Act treatment threshold; Norwegian Directorate of
# Fisheries MAB quota; EU Regulation 1379/2013 market standard Grade A/B.
# Suppression creates welfare violations, quota fraud, and export cert fraud.
THRESHOLD_SEA_LICE_AI    = 55  # Aquabyte/ViAqua; NMA treatment; ASC cert
THRESHOLD_WELFARE_AI     = 60  # Observe/iFarm; Aquaculture Act §10; ASC
THRESHOLD_COUNTER_AI     = 60  # VAKI/AquaCloud; Directorate MAB quota
THRESHOLD_GRADING_AI     = 65  # BioSort/Marel; EU Reg 1379/2013 Grade A/B


class AquacultureAIContext(str, Enum):
    SEA_LICE_UNDERWATER = "sea_lice_underwater"  # Aquabyte, ViAqua
    WELFARE_MONITORING  = "welfare_monitoring"   # Observe Technologies, iFarm
    FISH_COUNTER        = "fish_counter"         # InnovaSea VAKI, AquaCloud
    HARVEST_GRADING     = "harvest_grading"      # BioSort, Marel


def threshold_for(context: AquacultureAIContext) -> int:
    thresholds = {
        AquacultureAIContext.SEA_LICE_UNDERWATER: THRESHOLD_SEA_LICE_AI,
        AquacultureAIContext.WELFARE_MONITORING:  THRESHOLD_WELFARE_AI,
        AquacultureAIContext.FISH_COUNTER:        THRESHOLD_COUNTER_AI,
        AquacultureAIContext.HARVEST_GRADING:     THRESHOLD_GRADING_AI,
    }
    return thresholds[context]


async def scan_aquaculture_ai_image(
    image_path: str | Path,
    context: AquacultureAIContext,
    site_licence_hash: str,  # SHA-256 of Norwegian Directorate of Fisheries site licence no.
    pen_ref: str,            # e.g. "PEN-04-SalMar-Frøya-2026", "LOT-HARVEST-BioSort-88721"
    scan_session_id: str,    # Aquabyte camera session ID, VAKI counter session, grading run ID
    client: httpx.AsyncClient,
) -> dict:
    """
    Scan an aquaculture or fisheries AI image for adversarial injection payloads
    before forwarding to sea lice treatment threshold scoring, fish welfare
    indicator classification, biomass quota compliance reporting, or EU market
    standard grade assignment AI systems.

    Raises AdversarialAquacultureAIImageError if score meets threshold:
      - SEA_LICE_UNDERWATER: threshold 55; Norwegian Aquaculture Act §25;
                              Norwegian Medicines Act treatment threshold; ASC cert
      - WELFARE_MONITORING:  threshold 60; Norwegian Aquaculture Act §10;
                              ASC Salmon Standard Criterion 6.3; welfare indicators
      - FISH_COUNTER:        threshold 60; Norwegian Directorate of Fisheries MAB;
                              site licence condition; quota fraud Norwegian Penal Code
      - HARVEST_GRADING:     threshold 65; EU Reg 1379/2013 Grade A/B market standard;
                              export certificate; buyer contract grade warranty
    """
    image_bytes    = Path(image_path).read_bytes()
    image_b64      = base64.b64encode(image_bytes).decode()
    image_sha256   = hashlib.sha256(image_bytes).hexdigest()
    client_scan_id = str(uuid.uuid4())
    threshold      = threshold_for(context)

    resp = await client.post(
        GLYPHWARD_SCAN_URL,
        headers={"Authorization": f"Bearer {GLYPHWARD_API_KEY}"},
        json={
            "image": image_b64,
            "source": context.value,
            "metadata": {
                "aquaculture_context": context.value,
                "site_licence_hash":  site_licence_hash,
                "pen_ref":            pen_ref,
                "scan_session_id":    scan_session_id,
                "client_scan_id":     client_scan_id,
                "image_sha256":       image_sha256,
            },
        },
        timeout=8.0,
    )
    resp.raise_for_status()
    result = resp.json()

    audit_record = {
        "site_licence_hash":  site_licence_hash,
        "pen_ref":            pen_ref,
        "scan_session_id":    scan_session_id,
        "aquaculture_context": context.value,
        "scan_id":            result["scan_id"],
        "client_scan_id":     client_scan_id,
        "image_sha256":       image_sha256,
        "score":              result["score"],
        "flagged_region":     result.get("flagged_region"),
        "threshold":          threshold,
        "action":             "blocked" if result["score"] >= threshold else "allowed",
    }
    await write_aquaculture_audit_record(audit_record)

    if result["score"] >= threshold:
        raise AdversarialAquacultureAIImageError(
            f"Aquaculture AI image blocked [{context.value}]: "
            f"scan_id={result['scan_id']} score={result['score']} "
            f"site={site_licence_hash} pen={pen_ref}"
        )
    return result


async def write_aquaculture_audit_record(record: dict) -> None:
    """Persist audit record to aquaculture compliance monitoring store (stub)."""
    import json, sys
    print(json.dumps(record), file=sys.stderr)


class AdversarialAquacultureAIImageError(Exception):
    """Raised when an aquaculture or fisheries AI image exceeds the adversarial injection threshold."""
    pass

Call scan_aquaculture_ai_image() with AquacultureAIContext.SEA_LICE_UNDERWATER before forwarding Aquabyte or ViAqua underwater stereo camera images to AI sea lice count estimation and Norwegian Medicines Act treatment threshold classification tools — the integration point where adversarial suppression of a treatment threshold exceedance creates Norwegian Aquaculture Act §25 welfare violation and ASC certification audit exposure, with pen_ref linking the Glyphward scan record to the specific net pen sea lice monitoring event for Mattilsynet regulatory audit purposes. Call with AquacultureAIContext.WELFARE_MONITORING for Observe Technologies or iFarm behavioural welfare camera images before AI crowding stress and abnormal swim pattern classification, preserving image_sha256 as the forensic anchor for Norwegian Aquaculture Act §10 operational standard and ASC Salmon Standard welfare audit documentation. Call with AquacultureAIContext.FISH_COUNTER for InnovaSea VAKI optical counter sensor images before AI biomass estimation and Norwegian Directorate of Fisheries MAB quota compliance reporting, with site_licence_hash encoding the Norwegian Directorate of Fisheries site licence identifier for production licence compliance audit purposes. Call with AquacultureAIContext.HARVEST_GRADING for BioSort or Marel fish grading system images before AI EU Regulation 1379/2013 Grade A/B market standard classification and export certificate eligibility assessment, with pen_ref set to the harvest lot identifier for EU export certificate grade declaration audit trail linkage. Get early access

Coverage matrix

Control Sea lice underwater image AI injection (Aquabyte, ViAqua) Fish welfare monitoring AI injection (Observe Technologies, iFarm) Fish counter biomass AI injection (InnovaSea VAKI, AquaCloud) Harvest grading AI injection (BioSort, Marel)
Text-only PI scanners (Lakera, LLM Guard) No — adversarial pixel perturbations in Aquabyte underwater stereo camera images are invisible to text-based analysis No — Observe Technologies overhead camera behavioural pattern pixel manipulation is not detected by text-only scanning No — VAKI optical counter sensor frame pixel manipulation affecting biomass count AI is not caught by text analysis No — harvested fish product photograph pixel perturbations suppressing Grade B defect detection are not visible to text scanners
Farm veterinarian and HACCP review Farm veterinary surgeons review Aquabyte AI sea lice count reports and treatment threshold assessments; do not inspect individual underwater stereo image pixels for adversarial manipulation before treatment decisions Farm managers review Observe Technologies AI welfare scoring reports and crowding stress alerts; do not inspect individual overhead camera image pixels for adversarial manipulation before welfare intervention decisions Biomass reporting teams review VAKI AI fish count and weight estimation outputs; do not inspect individual optical counter sensor frame pixels for adversarial manipulation before quota compliance reporting Seafood quality managers review BioSort/Marel AI grade assignments; do not inspect individual harvested fish photograph pixels for adversarial manipulation before export certificate grade declaration
Norwegian regulatory and EU customs inspection Mattilsynet (Norwegian Food Safety Authority) reviews sea lice count records at site inspections; does not detect adversarial manipulation of Aquabyte AI camera inputs between inspection visits Mattilsynet reviews fish welfare monitoring records at site inspections; does not detect adversarial manipulation of Observe Technologies AI camera inputs between regulatory inspection visits Norwegian Directorate of Fisheries reviews monthly biomass reports; does not detect adversarial manipulation of VAKI fish counter AI inputs that generated the reported biomass data EU member state food safety authorities and customs inspect export certificate documentation; do not detect adversarial manipulation of BioSort/Marel grading AI inputs that generated the Grade A classification before export
Glyphward Yes — threshold 55; site_licence_hash and pen_ref audit trail; blocks adversarially crafted Aquabyte/ViAqua underwater images before AI sea lice count and NMA treatment threshold classification Yes — threshold 60; blocks adversarially crafted Observe Technologies/iFarm welfare images before AI crowding stress and behavioural anomaly classification, with image_sha256 for Aquaculture Act §10 and ASC audit Yes — threshold 60; blocks adversarially crafted VAKI optical counter images before AI biomass estimation and Norwegian Directorate of Fisheries MAB quota compliance reporting, with site_licence_hash for production licence audit Yes — threshold 65; blocks adversarially crafted BioSort/Marel harvest images before AI EU Reg 1379/2013 Grade A/B classification, with pen_ref harvest lot identifier for EU export certificate audit trail

Frequently asked questions

How does adversarial injection into Aquabyte sea lice counting AI differ from ordinary underwater image quality variation in salmon net pen environments, and why do Norwegian Mattilsynet inspections not detect adversarially manipulated sea lice count images?

Ordinary underwater image quality variation in salmon net pen environments — variable turbidity from suspended particulate matter in Norwegian fjord water affecting stereo camera depth perception, algae and biofouling on net pen structure surfaces interfering with background contrast for sea lice body detection, variable light penetration at different depths and times of day affecting Aquabyte AI spectral feature extraction, and salmon movement blur in high-activity feeding behaviour periods — is addressed by Aquabyte AI sea lice counting systems through stereo camera confidence scoring, image quality pre-filtering, and farm veterinarian escalation protocols for low-confidence AI sea lice count estimates, where underwater images falling below quality confidence thresholds are excluded from the weekly mean lice count calculation or flagged for veterinary surgeon review before treatment threshold assessment. The treatment threshold assessment workflow is therefore designed to handle image quality variation by excluding low-confidence images from the count — creating a pathway for quality-degraded images that is distinct from the normal treatment threshold exceedance response pathway.

Adversarial injection into Aquabyte AI sea lice counting produces the directly opposite outcome from quality-degraded image exclusion: a precisely crafted adversarial underwater camera image generates a high-confidence false-negative sea lice count output — the AI assigns high confidence to an incorrect below-threshold mean lice count, because the adversarial perturbations suppress the adult female sea lice visual classification signal while maintaining the overall image quality score above the confidence threshold that would trigger exclusion from the weekly count calculation. The adversarially manipulated underwater image contributes a false low-lice-count data point to the weekly mean calculation with a high-confidence quality flag, driving the calculated mean below the Norwegian Medicines Act treatment threshold when the true lice burden would place the mean above threshold. Norwegian Mattilsynet inspections review sea lice count records, treatment log documentation, and site operational records; they do not inspect individual Aquabyte AI underwater camera image pixels for adversarial manipulation. An Mattilsynet inspector reviewing sea lice compliance records will observe the AI-generated mean lice count outputs — including the adversarially suppressed week’s data showing below-threshold counts — and will not detect the manipulation unless a statistically anomalous treatment history pattern triggers a forensic data quality investigation. Glyphward pre-scan at the Aquabyte or ViAqua underwater camera image submission boundary is the only technical control that operates at the image-pixel level before high-confidence false sea lice count outputs are incorporated into the weekly mean calculation used for Norwegian Medicines Act treatment threshold assessment.

What are a Norwegian salmon exporter’s EU Regulation 1379/2013 and export certificate obligations when adversarial injection into BioSort or Marel grading AI causes Grade B product to receive Grade A export documentation?

A Norwegian salmon exporter’s EU Regulation 1379/2013 obligations when adversarial injection into BioSort or Marel grading AI causes Grade B product to receive Grade A export documentation operate on the market standard grade declaration dimension of EU Regulation 1379/2013 Annex I. EU Regulation 1379/2013 (Common Market Organisation) requires that fishery and aquaculture products marketed in the EU comply with minimum marketing standards and common grade standards for freshness and size, with Grade A and Grade B criteria defined for Atlantic salmon and other major aquaculture products; Norwegian exporters are required to declare that exported products meet the applicable EU market standard grade in export health certificates issued by Norwegian Mattilsynet under the EU-Norway equivalence framework. Adversarial manipulation of BioSort AI or Marel AI grading tools that causes Grade B product — with bruising, wound classification, or melanisation indicators exceeding Grade A quality thresholds — to receive Grade A export certificate documentation creates a false export health certificate declaration, which is a Norwegian export documentation violation with Mattilsynet enforcement consequences and an EU food law violation at the import destination under EU Regulation 178/2002 (General Food Law) Article 14 food safety requirements and Article 17 food operator responsibility obligations. EU member state food safety competent authorities at Norwegian salmon import ports — particularly Danish Fødevarestyrelsen (DVFA) and Dutch Nederlandse Voedsel- en Warenautoriteit (NVWA), which handle substantial Norwegian salmon import volumes — conduct identity and physical checks on Norwegian salmon consignments and may identify Grade B quality characteristics in consignments accompanied by Grade A export certificates, triggering non-conformity notifications and consignment rejection with costs borne by the Norwegian exporter under incoterms delivery conditions.

The buyer contract grade warranty consequences when adversarially inflated grade certification reaches European retail buyers are grounded in the purchase contract specifications and Norwegian salmon export market pricing conventions. Norwegian Atlantic salmon export contracts to European retail buyers — at supermarket chains including Tesco, Carrefour, and Lidl — specify Grade A quality criteria and reserve the buyer’s right to reject or claim price adjustment for consignments not meeting Grade A standards at delivery inspection; adversarial AI grading manipulation that causes Grade B product to be shipped under Grade A contractual grade warranties creates breach-of-contract claims with full consignment value adjustment and potentially contractual penalty clause exposure for repeat non-conformance events. The Glyphward pre-scan audit trail — including site_licence_hash, pen_ref harvest lot identifiers, image_sha256, and action log records for each fish grading scan — provides forensic documentation that an adversarial image injection detection control was deployed at the AI grading input boundary, which is significant evidence in Norwegian export documentation fraud proceedings and EU non-conformity investigation procedures where the exporter asserts that the Grade A mis-certification was caused by adversarial manipulation of its AI grading tools rather than inadequate quality management practice. Exporters with Glyphward Team tier coverage can present complete scan-session audit trails to Mattilsynet and EU competent authorities to demonstrate technical control compliance at the AI grade classification input boundary.

Further reading