mirror of
https://github.com/hanzoai/anomalib.git
synced 2026-10-30 18:48:11 +00:00
The previous commit was meant to remove .github/workflows and removed every tracked path instead — 892 files, the whole repo. This puts back the 874 that were never in scope; the eighteen workflow files stay gone, for the reasons that commit gives. Content is byte-identical to 9d2aec9 outside .github/workflows.
46 lines
1.3 KiB
Bash
46 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Using Patchcore Model with Anomalib CLI
|
|
# ------------------------------------
|
|
# This example shows how to use the Patchcore model for anomaly detection.
|
|
|
|
# 1. Basic Usage
|
|
# Train with default settings
|
|
echo "Training Patchcore with default settings..."
|
|
anomalib train \
|
|
--model patchcore
|
|
|
|
# 2. Custom Configuration
|
|
# Train with custom model settings
|
|
echo -e "\nTraining with custom model settings..."
|
|
anomalib train \
|
|
--model patchcore \
|
|
--model.backbone wide_resnet50_2 \
|
|
--model.layers layer2 layer3 \
|
|
--model.pre_trained true \
|
|
--model.num_neighbors 9
|
|
|
|
# 3. Advanced Training Pipeline
|
|
# Train with custom training settings
|
|
echo -e "\nTraining with custom pipeline settings..."
|
|
anomalib train \
|
|
--model patchcore \
|
|
--data.category bottle \
|
|
--trainer.max_epochs 1 \
|
|
--trainer.accelerator auto \
|
|
--trainer.devices 1 \
|
|
--trainer.default_root_dir results/patchcore
|
|
|
|
# 4. Multi-GPU Training
|
|
# Train using multiple GPUs for faster feature extraction
|
|
echo -e "\nTraining with multiple GPUs..."
|
|
anomalib train \
|
|
--model patchcore \
|
|
--data.category bottle \
|
|
--trainer.accelerator gpu \
|
|
--trainer.devices 2 \
|
|
--trainer.strategy ddp
|