Improved method for classification of data using dynamic vector partitioning and voting

By partitioning feature vectors into subfeature vectors and performing voting, the method addresses the curse of dimensionality and feature redundancy, enhancing classification accuracy in high-dimensional spaces with scarce data.

WO2025242538A1PCT designated stage Publication Date: 2025-11-27ESMART SYSTEMS AS

Patent Information

Application Number
PCT/EP2025/063415
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-22
Filing Date
2025-05-15
Publication Date
2025-11-27

AI Technical Summary

Technical Problem

Existing machine learning models face challenges with the curse of dimensionality and feature redundancy in high-dimensional spaces, particularly in few-shot learning scenarios with scarce data, which hinders efficient classification and adaptation.

Method used

A method involving dynamic vector partitioning and voting, using pretrained foundation models to divide feature vectors into subfeature vectors, apply distance metrics-based methods, and perform voting to enhance classification accuracy.

Benefits of technology

This approach effectively reduces feature redundancy and dimensionality, improving classification accuracy and adaptability in scenarios with limited data by focusing on relevant features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure EP2025063415_27112025_PF_FP_ABST
    Figure EP2025063415_27112025_PF_FP_ABST
Patent Text Reader

Abstract

The invention concerns a computer-implemented method for classifying test dataset x test such as at least one of images, videos, audio and text. The method further comprises the steps of performing feature extraction, dividing the feature vector into a plurality of subfeature vectors, classifying each subfeature vector specific classes and performing voting to determine an optimized class of the test dataset x test .
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Title  IMPROVED METHOD  FOR CLASSIFICATION OF DATA USING DYNAMIC VECTOR PARTITIONING AND VOTING  Technical Field

[0001] The invention concerns an improved methodology for handling challenges involving i.a.  curse of dimensionality and  feature  redundancy  in  classification of datasets  such as  images, audios  or  text.  The  improved  methodology  involves  classification  using  dynamic  vector partitioning and subsequent voting.  Background  AI Model Development for Power Line Inspection: A Data Challenge

[002] Developing AI models  for  classifying power  line  components and detecting defects presents significant challenges, predominantly due to the  limited availability of training data. This  problem  is  especially  pronounced  in  defect  classification  due  to  the  scarcity  of  image examples.

[003] Traditional  machine  learning  models,  reliant  on  extensive  datasets,  falter  in  this environment, necessitating the exploration of alternative methodologies.  Emergence of Few‐Shot Learning as a Solution to Data Scarcity

[004] In  response  to  the  shortage  of  data,  few‐shot  learning  has  emerged  as  a  pivotal strategy.

[0005] This approach empowers models to effectively learn from a minimal number of labeled  examples per class, adapting to new categories with scarce data.

[0006] Within the context of power line inspection, where encountering various defect types  is  infrequent,  few‐shot  learning  may  be  indispensable  for  developing  classifiers  capable  of recognizing and categorizing these rare defects.  Evolution of Few‐Shot Learning: Embracing Foundation Models

[0007] The  integration of foundation models has significantly advanced the domain of few‐shot learning, particularly in distance metrics‐based methods such as   ‐ prototypical networks (PN),   ‐ nearest neighbours (NN), and   ‐ nearest centroids (NC) (including nearest sub‐centroids (NSC)).

[0008] Foundation  models  have  unlocked  new  prospects  by  offering  advanced  feature extraction,  i.e. transforming raw  input values such as pixel values to feature vectors, thereby enriching the representation of input data. This advancement not only aligns with the inherent strengths  of  the  distance  metrics  based  methods  such  as  PNs  but  also  amplifies  their functionality, marking a substantial evolution in the field of few‐shot learning.

[0009] PNs, exemplary in this context, function by transforming support examples into feature  vectors and generating class prototypes through averaging these vectors.

[0010] Support  examples  may  be  images  used  for  creating  class  prototypes  while  test examples may be  images used for testing / classification. Support examples and test examples are  converted  to  their  respective  feature  vectors  through  the  above  mentioned  feature extractions.

[0011] A test example  /  test  image xtest  is classified by  locating the nearest class prototype, demonstrating the efficacy of PNs used in few‐shot learning scenarios.

[0012] The classification procedure is schematically illustrated in Figure 1 A‐C, where fig. 1 A  shows the single support feature vectors (circles) created by feature extraction methods and plotted  in the feature space, fig. 1 B shows the computation of class prototypes p1, p2 and p3 (squares) and  the  categorization  into  three  classes c  (areas encompassing  the  single  feature vectors and the class prototypes) and fig. 1 C shows the calculation of Euclidean distances d from  the test image xtest (triangle) to the prototypes pc of each class c.

[0013] Algorithm 1 shows an example of a prior art method for computing prototypes pc of  input raw data X based on a pretrained model F. The input raw data X comprises support dataset  xi, test dataset xtest, labels / classes yi of support dataset xi and available individual classes c for classifications. The output  is a  classification ytest of a  test example  ftest and  confidence  score Confidence(c). Note that ftest corresponds to the feature vector of xtest. These numerals will be  used hereinafter.  Algorithm 1 Prototypical Network Workflow    Input: Raw data ^^, Pretrained model ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^  1. 2. ∈ ^^   [Transform inputs into feature space] 3. 4.[Average features per class] 5. 6. [Transform test date into feature space] 7. െ ^^^ ∥  [Compute distance to prototypes] 8. ,^^^^  [Classify based on nearest prototype] 9. Confidence Scoring:  10. ^^′ ← െ^^^^^௧^^௧ , ^^^^  [Prepare distances for softmax] 11. Confidence^^^^ [Softmax to get confidence scores]

[0014] The main objective of  the above algorithm  is  to use  input raw data  (including both support  examples  and  test  examples)  in  a  few‐shot  learning  scenario  using  a  pretrained foundation model F as the feature extractor and PN model to perform classification. Relevant  examples of pretrained foundation models F are OpenAI’s CLIP and Meta’s Dinov2.

[0015] Euclidean distance in distance metrics based methods such as PNs forms the basis for  clustering and differentiating classes in few‐shot learning scenarios.

[0016] Its  effectiveness,  however,  diminishes  in  high‐dimensional  spaces  produced  by foundation models, leading to issues like the curse of dimensionality.

[0017] For a detailed explanation of the curse(s) of dimensionality, see the article N. Altman  et al., Nature Methods 15, 399‐400 (2018), hereby incorporated by reference.

[0018] Foundation models have significantly advanced the field of few‐shot classification by  enhancing feature extraction capabilities. Despite their advantages, these models also present notable  challenges which  are  primarily  linked  to  the  high‐dimensional  feature  vectors  they produce.

[0019] These  high‐dimensional  spaces  not  only  complicate  traditional  distance  metric applications such as PNs, and thereby invoking said curse of dimensionality, but also introduce the substantial  issue of feature redundancy. In these high‐dimensional spaces the richness of extracted features can be a double‐edged sword. While providing detailed and comprehensive data  representations,  the  models  often  generate  feature  vectors  filled  with  redundant  or irrelevant information.

[0020] Such  redundancy  or  irrelevancy  is  particularly  problematic  in  few‐shot  learning scenarios, where the model needs to learn and make accurate predictions from a limited set of  examples.

[0021] In addition, it typically also obscures significant features among less informative ones,  hindering the model's ability to learn efficiently and adapt rapidly to new tasks.

[0022] Challenges  related  to  feature  redundancy  in  high‐dimensional  spaces  for  few‐shot tasks are known  in the field, see e.g. X. Luo et al., Computer Vision and Pattern Recognition, submitted 5 Oct, 2023, arXiv 2310.03843 (Cornell University).

[0023] Another solution addressing the challenge of feature redundancy  is disclosed  in the article X. Zhu et al., Proc. Of the IEEE / CVF International Conference on Computer Vision (ICCV),  2023, pp. 2605‐2615.

[0024] However, these prior art methods do not provide a solution addressing both the curse of  dimensionality  and  the  feature  redundancy. Moreover,  their  attempt  to  address  feature redundancy  represents  an  alternative  approach  compared  to  the  method  according  to  the invention.   The need for improved methodologies

[0025] Hence,  confronting  the  complexities  of  high‐dimensional  spaces  from  foundation models demands  refined methodological approaches, especially  for distance metric  learning methods, which are able to efficiently address the above mentioned challenges, i.e. the curse of  dimensionality and the feature redundancy.

[0026] Such a methodological approach would ensure that only the most relevant features  are emphasized for classification in an accurate and consistent way.

[0027] This demand is particularly useful in few‐shot learnings scenarios where the input data  is scarce.

[0028] One important example is availability of images showing faults in power lines, where efficient  and  reliable  detection,  recognition  and  analyses may  have  huge  impact  on  power supply stability and safety.

[0029] Hence, in particular for few‐shot learning scenarios, these methodologies are crucial  for achieving precise classification and robust model adaptability.

[030] It  is thus an object of the present  invention to present a method that  improves the handling of high‐dimensional data compared to prior art method, and in particular classification  of dataset suffering from data scarcity.

[031] Another object of  the present  invention  is  to present a method  that addresses  the challenges posed by both the curse of dimensionality and the feature redundancy.

[032] A  further objective of  the  invention  is  to  facilitate  the use of  features extracted by foundation models for few‐shot learning without need of fine‐tuning.

[033] A  further objective of  the  invention  is  to  facilitate use of  large  feature  vectors  for allowing combination of features from multiple foundation models.

[0034] Other objectives will be apparent from the discussions of advantages  /  effects of the  various methods presented hereinafter.  Summary of the Invention

[035] The present  invention  is  set  forth  and  characterized  in  the main  claims, while  the dependent claims describe other characteristics of the invention.

[036] In  a  first  aspect,  the  invention  concerns  a  computer‐implemented  method  for classifying test dataset xtest such as at least one of images, videos, audio and text. The images  may  for  example  be  images  with  and  without  particular  anomalies  such  as  defects  in components. The text may for example be e‐mail classifications.

[037] The  initial  step  of  the  method  is  A:  receiving  input  data  comprising  classification dataset X, a subfeature size set S comprising a number of subvector segments j  and a pretrained  model set Fset comprising at least one pretrained model F. The classification dataset X comprises  a support dataset including input classes of the support dataset, a number of individual classes  c for classification and the test dataset xtest. The subfeature size set S comprises a number of  subvector  segments  j  for  each  feature  vector  SFVi,j,SFVtest,j    The  pretrained  model  set  Fset comprises one or more pretrained models  F  such  as  the  commercially  available  foundation models Meta’s Dinov2 or OpenAI’s CLIP. The number of individual classes c may be any positive  integer such as 2, 3, 4, 5 or 6. For example 2 individual classes, class 1 and class 2, may represent  defect and non‐defect in a component of a power line system.

[0038] Note that the number of subvector segments j in the subfeature size set S covers the  case where there is only one subfeature size (S= {s1})  (i.e. all subfeature segments j have the  same size) or the case where there is a plurality of subfeature sizes  (i.e. some  or all of the subfeature segments j have different sizes, s1, s2,...,sn) in step A may contain alternative data from which the number of subfeature segments j may be  calculated, for example by dividing the total number of features with the size of the subfeature  vector.

[0039] The method further comprises the steps of  ‐ B: performing feature extraction of the support dataset xi and the test dataset xtest of the  classification  dataset  X  using  the  pretrained  model  set  Fset  to  generate  support  feature vectors fi and test feature vectors ftest, respectively;  ‐ C: in accordance with the number of subvector segments (j) within the subfeature size set (S),  dividing each support feature vector fi into a plurality of support subfeature vectors SFVi,j and  each test feature vector ftest into a plurality of test subfeature vectors SFVtest,j, respectively,  wherein each of the subfeature vectors SFVi,j,SFVtest,j contain at least one, preferably at least  two, subvector feature(s)  /  sub‐dimension(s) sj;  ‐ D: for each test subfeature vector SFVtest,j, implementing at least one distance metrics‐based  method to assign the subfeature vector SFVtest,j to a specific individual class c, and  ‐ E: performing voting of the test subfeature vectors SFVtest,j based on the assigned individual  classes c to determine a predicted  /  optimized class ytest for the test dataset xtest and thus  enhancing the production accuracy of the classification.

[0040] This method introduces a robust process for classifying test datasets by using one or  more pretrained foundation models for feature extraction and subsequent vector partitioning. The division of vectors  into subfeature vectors reduces  feature redundancy and  the curse of dimensionality.

[0041] For the challenge with feature redundancy particular reference is made to step C. By  dividing the feature vectors into smaller subfeature vectors, each subfeature vector focuses on  a distinct subset of features. This helps in identifying and isolating redundant features that do  not contribute to classification accuracy. Also, redundant features within each subfeature vector have  less  influence on  the overall classification, as  their  impact  is  limited  to  specific  subsets rather than the entire feature set.

[0042] The curse of dimensionality  is particularly addressed  in step D as  further described above.

[0043] At least one of the distances used in the distance metrics‐based method(s) may be an  Euclidian distance.

[0044] The  step(s) of  the method(s) mentioned  in  step D may  involve  the  test  subfeature vector SFVtest,j and at least one of the support subfeature vectors SFVi,j.

[0045] The voting in step E may be based on majority voting, i.e. the individual class c having  the highest number of assigned test subfeature vectors SFVtest,j becomes the predicted class  ytest. Alternatively  the  voting may be  a weighted  voting  taking  into  account one or more weight factors w (see below).

[0046] Such majority  voting may be performed  as  follows:  Each  sub‐classifier  is  classified separately. Each time a sub‐classifier classifies a subfeature vector as class A, class A will get one  vote. The same is performed for the remaining classes B, C, etc. The total number of votes for  each class is then counted (A, B, C, etc) and the class that has the majority of the vote becomes  the selected output of the model (predicted class).

[0047] Steps D and E ensure that the test  image xtest  is classified based on the most similar feature patterns observed during training, thereby leveraging the rich information encoded in  the feature space.

[0048] In an exemplary process, the at  least one distance metrics‐based method  in step D determining  /  allocating the individual class c for the test subfeature vectors SFVtest,j comprises at  least  one  of  prototypical  networks  PN,  nearest  neighbors NN,  nearest  centroids NC  and nearest sub‐centroids NSC.

[0049] The prototypical networks PN method involves calculating sub‐prototypes pc_j of the support  subfeature  vectors  SFVi,j  and  finding  minimum  distance  dminj  between  the  support subfeature vectors SFVi,j and the sub‐prototypes pc_j. The nearest neighbors NN method involves  calculating k nearest neighbors and / or all neighbors within a radius r from each test subfeature vector  SFVtest,j.  The  nearest  centroids  NC  method  involves  calculating  centroids  Cc_j  for  the support  subfeature vectors SFVi,j and  finding  the centroid Cc_j nearest  to  the  test  subfeature vector  SFVtest,j.  And  the  nearest  sub‐centroids  NSC  method  a  plurality  of  determined  sub‐centroids SCc_j of each individual class c (for example determined by clustering) are applied to  find the nearest sub‐centroid NSCc_j to the test subfeature vector SFVtest,j.

[0050] Each of these metrics‐based method has characteristics that may be beneficial for the classification and should be determined on a case by case basis. For example,  in nearest sub‐centroids (NSC) in few‐shot learning each class is represented by multiple sub‐centroids (instead  of a single one as in nearest centroids (NC)). This approach could assist in capturing the internal variance within  classes  more  effectively  by  acknowledging  different  sub‐groups  or  patterns within a class with the aim of refining class representations for improved classification accuracy  in scenarios with significant intra‐class variation.

[0051] The use of various distance metrics‐based methods like prototypical networks, nearest  neighbours, and centroids allows for flexibility and precision, particularly in scenarios with scarce  data.

[0052] In another exemplary process,  step D may  further  comprise  calculating  confidence values / scores Confidencej(c) of each test subfeature vector SFVtest,j and each  individual class c and step E may further comprise collecting and averaging the confidence scores Confidencej(c) for  the  respective  test subfeature vectors SFVtest,j  to determine a predicted confidence value Confidence(c) for the predicted class ytest of the test dataset xtest.

[0053] Integrating confidence value calculations in class assignments and averaging these for  final predictions enhances the trustworthiness of the confidence scores, thereby increasing The  model's reliability.

[0054] In another exemplary process, the subfeature vectors (SFVi,j,SFVtest,j) corresponding to  two or more of the subvector segments (j) have dissimilar number of subvector features (sSF,j).

[0055] Using multiple  subsector  sizes  address  the  loss  of  global  relationships  and  enable modelling feature relationships at different levels. A small size will capture local relationships in small groups of features, while a  large size will capture global relationship  in  large groups of features.

[0056] In another exemplary process, the input data in step A may further comprise a sorting technique  set T  comprising one or more  sorting  techniques  t. Furthermore,  the  step B may further comprise choosing a sorting technique t from the sorting technique set T, generating a  number of sorting indices equaling the number of features in the support feature vectors fi and  sorting the support feature vectors fi and the test feature vectors ftest according to the chosen  sorting technique t and the generated sorting indices.

[0057] Said sorting technique set T may comprise a sorting technique based on computing  standard deviation ^sort for each feature of the support feature vectors fi or a function of the  support feature vector fi and / or each feature of the test feature vector ftest. Said sorting may  thus be based on such standard deviation ^sort for generating the sorted support feature vector(s)  fi and the sorted test feature vector(s) ftest.

[0058] In  addition,  or  alternatively,  said  sorting  technique  set  T  may  comprise  a  sorting technique  based  on  computing  distance  dsort  between  each  feature  of  the  support  feature vectors fi or each feature of a function of the support feature vector fi and / or each feature of  the test feature vector ftest. Said sorting may thus be based on such distance dsort or a function of  the distance dsort for generating the sorted support feature vector(s) fi and the sorted test feature vector(s)  ftest.  The  distance  may  be  at  least  one  of  average  distance,  maximum  distance, minimum distance, standard deviations of the distances.

[0059] In  addition,  or  alternatively,  said  sorting  technique  set  T  may  comprise  a  sorting technique  based  on  performing  constrained  k‐means  clustering  for  features  of  the  support feature vectors  fi or a  function of  the  support  feature vectors  fi and / or  features of  the  test feature vectors ftest. The principles of ‘constrained k‐means’ are considered known for a skilled person  and  is  hence  not  described  in  details.  For  an  overview,  see  e.g. https: / / pypi.org / project / k‐means‐constrained / ,  which  contents  are  included  herein  by reference.

[0060] The constrained k‐means clustering ensures that the feature dimensions are clustered into a  fixed number of  sub‐feature vectors SFV  /  groups, as well as enforces  that each  sub‐feature vector SFV contains  the  same number of  features  s  /   feature dimensions. The  latter ensures that the sub‐feature vectors SFV have uniform sizes s. Once clustered, the features are  reordered so that members of the same cluster appear consecutively in the feature vector f.

[0061] Other clustering algorithms that allow specification of the number of output clusters such  as  standard  k‐means,  spectral  clustering,  hierarchical  clustering with  depth  control  or Gaussian Mixture Models (GMMs) with a fixed number of components can also be employed for the sorting. These methods group  features based on  their mutual similarities, which may be defined using distance metrics (e.g. Euclidean or cosine), correlation or learned embeddings.

[0062] Feature sorting  into clusters as those described above may be performed based on features having similar statistical and / or semantic characteristics across the support vector set(s) and / or  the  test  vector  set(s). By  treating  each  feature  as  an  individual entity, unsupervised  clustering algorithms can be applied to organize features into coherent groups based on their  similarity profiles.

[0063] Clustering  features  rather  than  data  samples  enables  the  identification  of  latent structure  within  the  feature  space,  resulting  in  more  semantically  meaningful  sub‐feature vectors. This again improve both interpretability and classification performance by ensuring that  each mini‐classifier operates on a cohesive and informative subset of features.

[0064] As  a  result,  clustering‐based  sorting  techniques  such  as  those  mentioned  above represent  a  flexible  and  scalable  strategy  for  organizing  high‐dimensional  feature  spaces, supporting  enhanced  sub‐vector  grouping  and  robust  classification  across  a  wide  range  of applications.

[0065] In  addition,  or  alternatively,  said  sorting  technique  set  T  may  comprise  a  sorting technique based on performing random permutations of the features  /  feature dimensions sj,stest  of the feature vectors fi,ftest, followed by evaluation of each permutation using performance‐ based criteria or statistical criteria. This approach is flexible and does not rely on assumptions about the semantic or statistical structure of the feature space.  Instead,  it  leverages  iterative search and scoring functions to identify effective feature arrangements.

[0066] One method involves applying multiple random permutations and evaluating each one  on a validation or test set. The permutation that achieves the highest classification accuracy is  selected. This performance‐driven method is particularly useful when labeled validation data is  available to guide the permutation search.

[0067] Alternatively, when no test or validation  labels are available, the support set or test set alone can be used to evaluate permutations. For each random permutation of the feature  indices, the feature vectors are reordered and divided into sub‐feature vectors (groups). Each permutation  is  then  scored  using  a  customizable  evaluation  function  designed  to  reflect desirable statistical or structural properties of the resulting groups.

[0068] Examples of scoring strategies based on standard deviation include:  ^ Total Group Standard Deviation: Compute the standard deviation of each group across  support examples and sum them. A lower total indicates more stable and consistent  group behavior.  ^ Standard Deviation of Group STDs: Calculate the standard deviation of the group‐level  standard deviations. A higher value reflects greater contrast between groups, which can  help identify both highly informative and redundant feature groupings.  ^ Combined Objective: A weighted combination of the two objectives may also be used— favoring permutations with high contrast while ensuring that at least a subset of groups  remains statistically tight and useful.

[0069] Beyond standard deviation, the scoring function may be defined using any statistical or domain‐specific criterion, such as entropy, mutual  information, feature correlation, group‐wise  variance,  or  other  heuristic  metrics  that  capture  the  desired  intra‐  and  inter‐group characteristics.

[0070] This randomized, search‐based approach is model‐agnostic and adaptable to different  types of features, domains, and classification tasks. It allows developers to explore the feature  permutation space flexibly using a variety of scoring criteria depending on available data and  the nature of the problem.

[0071] Implementing  sorting  techniques  prior  to  classification  organizes  the  data  more effectively,  reducing  the  influence of outliers and aligning  features optimally  for  subsequent analysis steps. This strategic sorting process serves the purpose of grouping features with similar characteristics,  such  as  standard  deviation  or  distance  between  prototypes,  into  the  same subfeature vectors. This meticulous feature sorting step is effective to align features optimally  and mitigate the potential influence of outliers or features with extreme distances on the final  classification decision.

[0072] In another exemplary process,  the  input data  in  step A  further comprises a weight factor set W and wherein at least one of the individual classes c assigned in step D is weighted with  at  least  one  weight  factor  w  among  the  weights  factor  set  W  when  determining  the predicted class ytest in step E. The weighting in step D may be achieved for example by multiplying  the at least one weight factor w with one or more of the individual classes c.

[0073] Weight factors applied during the voting process allow the system to emphasize more  reliable subfeature vectors, enhancing the accuracy of the final classification decision

[0074] In  addition,  or  alternatively,  at  least  one  of  the  calculated  confidence  values Confidencej(c)  may  be  weighted  with  the  at  least  one  weight  factor  w,  for  example  by multiplication.

[0075] Weighting  confidence  scores provides  a  refined mechanism  to  assess  classification reliability, particularly useful in ensuring the robustness.

[0076] In another exemplary process, the method further comprises initializing a list of sub‐classifiers  SubClassifiers,  wherein  the  input  data  in  step  A  further  comprises  a  selection percentage P% for selecting a specific part  /  subset of the  list of sub‐classifiers SubClassifiers, and wherein step D further comprises updating the list of sub‐classifiers SubClassifiers with at  least the assigned individual classes c, sorting the list of sub‐classifiers SubClassifiers based on  at least one type of parameters for each test subfeature vector SFVtest,j generated by the at least one distance metrics‐based method and selecting  the specific part  /  subset of sub‐classifiers SelectedSubClassifiers among  the  list of  sub‐classifiers  SubClassifiers by use of  the  selection percentage P%.

[0077] The selection percentage P% may for example be chosen for selecting a top part and / or  a bottom part of the list of sub‐classifiers SubClassifiers.

[0078] In another exemplary process, step D may further comprise updating the list of sub‐ classifiers SubClassifiers with at least the assigned individual classes c and the confidence values  Confidencej(c) generated by the at least one distance metrics‐based method, sorting the list of  sub‐classifiers SubClassifiers based on at least the confidence values Confidencej(c) in a sorted  order, for example descending or ascending order, and selecting the specific part, for example  a top part and / or a bottom part, of sub‐classifiers SelectedSubClassifiers among the list of sub‐ classifiers SubClassifiers by use of the selection percentage P%.

[0079] The selective use of sub‐classifiers based on predefined criteria ensures that only the most effective classifiers  influence  the  final decision,  thereby  further addressing  the  feature redundancy. Moreover,  Selecting  sub‐classifiers based on  their  confidence  values  enables  a prioritization of the most accurate predictors, further address the feature redundancy.

[0080] In  another  exemplary  process,  if  in  step  A  a  pretrained  model  set  Fset  is  chosen comprising a plurality of pretrained models F, then the feature extraction of the support dataset xi  generating  support  feature  vectors  fi  and  the  feature  extraction  of  the  test  dataset  xtest generating test feature vectors ftest may be performed for at least two of the pretrained models F. Based on these  feature vectors generated  from different pretrained models F, step B may further comprise merging the support and test feature vectors fi,ftest into a concatenated support  feature vector fi and into a concatenated test feature vector ftest, respectively. The concatenated  support feature vectors fi and the concatenated test feature vector ftest may then be employed  in steps C and D. The feature vectors fi,ftest of said merging should be limited to feature vectors  of the same support and test datasets xi,xtest.

[0081] Combining  features  from  multiple  foundation  models  into  a  concatenated  vector ensures a comprehensive analysis of data, capturing a broader spectrum of features and thereby  enhancing the model’s capability to generalize across different data types and structures.

[0082] Step  B  of  the  exemplary  process  may  further  comprise  the  steps  of  verifying compatibility of  the at  least  two of  the pretrained models F and deciding  if a normalization between the at least two pretrained models F is desirable or necessary.

[0083] If the decision is affirmative, each of the concatenated support feature vectors fi and  each of the concatenated support feature vectors fi extracted in step B may be normalized by a  normalization process.

[0084] Such a normalization process may comprise calculating means µ(fi),µ(ftest) and standard  deviations ^(fi),^(ftest) and normalizing using these calculated means µ(fi),µ(ftest) and standard  deviations ^(fi),^(ftest).

[0085] Normalizing feature vectors standardizes the input data, mitigating the effects of scale  disparities and enhancing model consistency and reliability.

[0086] If the at least one distance metrics‐based method in step D comprises a prototypical networks  PN method,  step  C may  further  comprise  calculating  sub‐prototypes  pc_j  for  each individual class c and each support subfeature vector SFVi,j. Step D may then further comprise the  steps of  calculating  for each  test  subfeature vector SFVtest,j and each  individual  class  c a distance dj between the test subfeature vector SFVtest,j and the sub‐prototype pc_j, determining  a minimum distance dminj among the calculated distances dj and setting the individual class c of the  test  subfeature  vector  SFVtest,j  to  the  individual  class  c  corresponding  to  the  minimum distance dminj.

[0087] Prototypical networks PN  represents a simple, effective and powerful approach  for utilizing features from commercially available foundation models for few‐shot learning.

[0088] In another exemplary process  the  test dataset  xtest  comprises a plurality of  images showing products  /  objects within a certain category  /  type and in particular categories  /  types  suffering from image scarcity.

[0089] Such a category may be biological objects such as animals (e.g. mammals, birds, fish,  reptiles or amphibians) or human beings. For example, one classification may be to distinguish  certain type of mammals such as dogs or cats. Another exemplary category may be non‐living  objects such as components of installations.

[0090] For  example,  one  specific  classification  may  be  to  register  any  anomalies  on components within a power supply system by comparing non‐labelled  images of one type of power line component (for example power line insulators or power line conductors of unknown state) with  labelled  images  (for  example  corresponding power  line  insulators or power  line conductors of known state).

[0091] As mentioned in paragraph

[0002] , detecting defects from limited availability of training data  such  as  in  power  line  inspection  represent  a  significant  challenge. Applying  this  novel method have the potentiality of improving the accuracy of such classification due to inter alia  its highly efficient handling of the curse of dimensionality and feature redundancy.

[0092] In another exemplary process  the  test dataset  xtest  comprises a plurality of audios. Examples of such process may be categorization of animal sounds or human languages.

[0093] In another exemplary process the test dataset xtest comprises text. Examples of such  process may be categorization of subject lines in e‐mails.

[0094] In  a  second  aspect,  the  invention  concerns  a  computer‐readable  storage  medium comprising instructions which, when executed by a computer, cause the computer to carry out  the steps of the computer‐implementer method as described above.

[0095] Note that all variations of the first and second aspects described above share at least  the common elements,   ‐computaƟon  of  distances  in  high‐dimensional  spaces  by  use  distance  metrics‐based methods and   ‐employment  of  parƟƟoning  of  high  dimensional  feature  vectors  extracted  by  use  of pretrained foundaƟon models.

[0096] Note further that even  if the above described methods are focused on classification into a plurality of classes, the inventive methods are also effective for one‐class scenarios such  as anomaly detection. This one‐class adaptability is achieved by measuring the distance between  a test example and support examples, or functions derived from these support examples such as  prototypes,  centroids,  sub‐centroids,  and  nearest  neighbours.  If  this  distance  is  below  a certain threshold, the test example is classified as belonging to the normal class, confirming it fits expected patterns.  If  it exceeds  the  threshold,  it  flags  the example  as  an  anomaly. This method  provides  a  straightforward  and  reliable way  to  both  detect  anomalies  and  confirm normalcy, making it versatile for various applications with limited data.

[0097] Hence, the above mentioned classification method presents an improved approach of  handling high‐dimensional data compared to prior art method, and in particular classification of  dataset suffering from data scarcity.

[098] In order  to address  the  limitations of  traditional  few‐shot  learning such as curse of dimensionality  and  feature  redundancy,  the  approach  presents  a  novel  way  of  processing feature vectors  involving dividing each feature vector  into subfeature vectors and performing voting of the latter. As exemplified in paragraphs [175‐179], executing a software based on this  novel method results in a significant increase in classification accuracy compared to executing a  software based on a prior art method as depicted  in  figure 2  (see below) and exemplified  in algorithm  1.  And  this  novel method  is  particularly  suited  for  image  classification when  the number of available support and test image examples are scarce.

[099] In  the  following description, numerous  specific details are  introduced  to provide a thorough understanding of embodiments of the claimed method. One skilled in the relevant art,  however, will recognize that these embodiments can be practiced without one or more of the  specific details, or with other few‐shot learning methods, dataset types etc.   Brief Description of the Figures

[100] Figure 1 schematically  illustrates classification of data using a prototypical networks PN method in a few‐shot learning approach, wherein figure 1A shows feature vectors in feature  space forming three distinct clusters, figure 1B shows creation of prototypes for each class  /   cluster and figure 1C shows classification of a test image.

[101] Figure  2  shows  a  prior  art  flow  diagram  for  training  a machine  learning model  to classify datasets such as images using a pretrained foundation model.

[0102] Figure 3 schematically illustrates classification of test images using Euclidean distance  measurements between a  test  image  feature vector and  two  support  image  feature vectors belonging to different classes.

[0103] Figure 4 shows a flow diagram describing a classification method in accordance with  one  embodiment  of  the  invention  which  involves  dividing  feature  vectors  extracted  by pretrained foundation model(s) into sub‐feature vectors and performing subsequent voting.

[0104] Figure  5  schematically  illustrates  a  classification  method  in  accordance  with  the invention, wherein the feature vectors are divided into a plurality of sub‐classifiers comprising  two features  /  dimensions and wherein a voting system is applied on said sub‐classifiers.

[0105] Figure 6 shows a flow diagram describing a classification method in accordance with a  second embodiment of  the  invention being  similar  to  the  first embodiment, but which also involves dividing the feature vectors into subfeature vectors of potentially dissimilar number of  features.

[106] Figure  7  schematically  illustrates  the  classification method  in  accordance  with  the method of Figure 6.

[0107] Figure 8 shows a flow diagram describing a classification method in accordance with a  third embodiment of  the  invention being similar  to  the second embodiment, but which also involves sorting the feature vectors using a specific sorting technique prior to division.

[0108] Figure 9 shows a flow diagram describing a classification method in accordance with a  fourth embodiment of  the  invention being  similar  to  the  third embodiment, but which also involves performing weighted voting.

[0109] Figure 10 shows a flow diagram describing a classification method in accordance with  a fifth embodiment of the  invention being similar to the fourth embodiment, but which also involves selecting a specific part of a list of sub‐classifiers used in the sorting step.

[110] Figure 11 schematically  illustrates  the classification method  in accordance with  the method of Figure 10.

[111] Figure 12 schematically  illustrates a classification method  in accordance with a sixth embodiment of the invention, which involves mering feature vectors extracted from different  pretrained foundation models.

[0112] Figure 13 shows a flow diagram describing the classification method of figure 12.  Detailed Description of the Figures

[0113] Hereinafter several embodiments of the inventive method will be described outlining  the  steps  and  considerations  for  effectively  implementing  the  inventive  few‐shot  learning approach.

[0114] As  mentioned  above,  Figure  1  illustrates  a  distance  metrics‐based  classification procedure  following  the principles of  the prototypical networks PN method. Moreover,  the algorithm 1 describes one example of such a prior art classification procedure. Other examples  of efficient distance metrics‐based classification procedures (which all can be used in few‐shot learning  approaches  using  pretrained  foundation  models)  are  k‐nearest  neighbours  k‐NN, nearest centroids NC and nearest sub‐centroids NSC. These distance metrics‐based classification  procedures are well known in the field and will thus not be described in detail.

[0115] Such  classification  of  test  datasets  based  on  feature  extraction  by  pretrained foundation models and analyses using distance metrics‐based method  is known  in  the  field. Figure 2 provides a  flow diagram  illustrating the main steps of such prior art classification  in which a pretrained foundation model F such as OpenAI’s CLIP or Meta’s Dinov2 forms part of  the input parameters in the classification approach, in addition to support and test datasets xtest,  xi. Hereinafter test dataset xtest and support dataset xi is defined as the data to be classified and the data setting  the condition  for  the classification,  respectively. The support dataset xi may comprise  data having the same format as the test data as well as available individual classes c  into which the test dataset xtest shall or could be categorized.

[0116] In particular, the prior art flow diagram of Figure 2 comprises the step of:  10:  Inputting a pretrained  foundation model F and raw data X  into the workflow  /  software, wherein the raw data X comprises a support dataset xi  (including lables / classes yi of the support  dataset xi and available individual classes c) and a test dataset xtest.  20: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi, ftest comprises a number of features  /  dimensions  si,stest.  30: Classifying each test feature vector into available individual classes using a distance metrics‐ based model such as prototypical networks PN model, typically using Euclidean distances.  40. Outputting the resulting class ytest of the test dataset xtest.

[0117] Figure 3 schematically illustrates the classification approach according to the prior art  method wherein the test image xtest may be classified into two classes, class 1 (pc=1) and class 2  (pc=2). When the prototype feature vectors for class 1 (pc=1) an class 2 (pc=2) and the test image  feature vector (ftest) has been generated by the pretrained Foundation model F, the Euclidean  distance 1 (ED1) between pc=1 and ftest and the Euclidean distance 2 (ED2) between pc=2 and ftest  is calculated, and the classification of the test image xtest is chosen for the smallest of ED1 and  ED2. In this case, test image xtest is classified to class 1 since ED1 is less than ED2. The predicted  class is thus ytest = class 1.

[0118] A prototype  feature  vector pc  is herein  essentially  the mean of  all  feature  vectors within a specific class c, thereby serving as a representative point in the feature space for that  class.

[0119] In algorithm 1  shown above,  the above described  calculations and  comparisons of Euclidean distances are found in lines 7 and 8. After allocating a class ytest to the test image xtest,  the confidence score ^^^^^^^^^^^^^^^^^^^^^^^^ may be calculated using Softmax (lines 10‐11).

[0120] As  discussed  above  this  prior  art  classification  approach  suffers  from  several disadvantages.

[0121] In order to mitigate these disadvantages, a novel classification approach is introduced  that involves dividing the feature vectors into subfeature vectors, followed by generating sub‐classifiers as basis for subsequent voting. This  inventive approach not only reduce number of features  /  dimensions to be analyzed, and thus solving a variety of challenges concerned with  high‐dimensional spaces. The approach specifically reduces the challenges concerned with both the curse of dimensionality and  the  issues of  feature redundancy, as will be apparent  in  the below described examples.

[0122] Algorithm  2  shown  below  provides  a  specific,  non‐limiting  example  of  how  such divisions  into  sub‐classifiers of a certain  size and a  subsequent voting may be programmed, wherein the classification is based on prototypical networks PN method. In algorithm 2 ^^^ೕ and  ^^௧^^௧ೕ represents prototype for each class for each subfeature segment and classificaƟon of the  corresponding test subfeature segment, respecƟvely.  Algorithm 2 Enhanced Workflow with Subfeature Vectors and Voting  Input: Raw data  ^^, Pretrained model ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon:  2. ^^^ ← ^^^^^^^ for each ^^^ ∈ ^^   [Transform inputs into feature vectors] 3. Divide into Subfeature Vectors:   4. Divide ^^^ into ^^^^^^^^    [Subfeature vectors of equal size]  7. ClassificaƟon of Test Examples:   8. ^^௧^^௧ ← ^^^^^௧^^௧^ and divide into ^^^^^^௧^^௧ೕ   9. For each test subfeature vector ^^^^^^௧^^௧ೕ:   ^^ ^^୮^ିௗ^ௌி^^^ೞ^ೕ12. ^^^^^^^^^^^^^^^^^^^^^^^^^ ←∑^ᇲ ^^୮ ^ିௗ^ௌி^^^ೞ^ೕ13. VoƟng and Confidence AggregaƟon:   14. Collect all ^^௧^^௧ೕ and ^^^^^^^^^^^^^^^^^^^^^^^^^   15. ^^௧^^௧ ← mode of ^^௧^^௧ೕ   [VoƟng based on subfeature classificaƟons] 16. Confidence^^^^ ← average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^

[0123] The  main  differences  between  algorithm  1  (providing  an  example  of  a  prior  art classification) and algorithm 2 (providing an example of an inventive classification via subfeature vectors  /   sub‐classifiers) are  seen  in  line 4 where  support  feature vectors  fi are divided  into subfeature vectors SFVi,j of size sSF), in line 8 where the test image feature vectors ftest are into subvector SFVtest,j of same size sSF and  in  line 15 where the voting of the  individual results are performed.

[0124] In algorithm 2, the feature vectors fi are used to calculate support subfeature vectors  SFVij which again are applied when calculating prototype subfeature vectors.

[0125] Alternatively,  prototypes  pc  may  be  calculated  directly  from  the  support  feature vectors  fi, wherein  these prototypes pc are divided  into prototype  subfeature vectors pc,j.  In terms of processing speed the former approach (calculate prototypes pc first and store them) may be  preferable  in  terms of  processing  speed  since  there will be  no  need  to  recalculate prototypes pc if duplications of feature vectors are performed (see further details below).

[0126] Figure  4  presents  a  flow  diagram  of  an  example  of  the  inventive  method  which comprises the following steps:  100: Inputting a pretrained foundation model F and raw data X into the workflow  /  software,  wherein the raw data X comprises a support dataset xi (including available individual classes c)  and a test dataset xtest.  200: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi,ftest involves sizes having a number of features  /   dimensions si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000.  The  size  si  for  each  support  feature  vector  is  typically  equal  to  the  size  stest  for  the corresponding test feature vector.  610: Dividing  the  support  feature  vector  fi  and  the  extracted  test  feature  vector  ftest  into  a number of support subfeature vectors SFVi,j of fixed size sSF,j and a number of test subfeature  vectors SFVtest,j of fixed size sSF,test, respectively.   620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   700: Performing voting of the test subfeature vectors SFVtest,j to determine a resulting class ytest.  The voting may be a majority voting or a weighted voting (see below).   800: Outputting the resulting class ytest of the test dataset xtest.

[0127] For  the  flow diagram  above,  and  all  flow diagrams described  in  the  following,  the sequence of steps may be  interchanged  if this  is not  influencing the final result,  i.e. resulting class ytest.

[0128] If prototypical networks PN method is chosen (as in algorithm 2), the classifying step  would involve calculating sub‐prototypes pc,j for each individual class and each support feature vector,  and  determining  minimum  distances  between  the  test  subfeature  vectors  and  the calculated sub‐prototypes pc,j for each class c.

[0129] Alternatively,  or  in  addition,  if  nearest  sub‐centroid  NSC  method  is  chosen,  the classification comprises calculating a plurality of sub‐centroids for each  individual class c and classifying each test subfeature vector SFVtest,j into the  individual classes c by determining the nearest sub‐centroid to the subfeature vector SFVtest,j in question.

[0130] Figure 5 schematically illustrates the classification approach according to the inventive  method disclosed in Figure 4 and exemplified in algorithm 2. As for the example shown in Figure  3, the test image xtest may be classified into two classes, class 1 (pc=1) and class 2 (pc=2) after having  been calculating prototypes p1,p2 of the support feature vectors fi for each class c and dividing  the prototypes p1,p2 and the test feature vector ftest into j=6 subfeature vectors pc,j, SFVtest.j, each  containing two features  /  dimensions (s=2).

[0131] In this example, the number of subfeature vectors SFVtest,j, SFVi,j equals the number of  sub‐classifiers used for the subsequent voting.

[0132] Suitable pretrained foundation models, for example Meta’s Dinov2 or OpenAI’s CLIP,  allow extraction of a comprehensive set of feature vectors from such images xi,xtest, effectively  capturing underlying image patterns and nuances.

[0133] For example, the support dataset xi  and the test dataset xtest may be images of specific  artifacts such as defects in power line components.

[0134] The  flow  diagram  in  Figure  6  and  the  algorithm  3  shown  below  provides  another specific, non‐limiting example of a classification approach according to the invention, wherein  the support and test feature vectors fi,ftest are divided into subfeature vectors SFVi,j, SFVtest,j of   Algorithm 3 Enhanced Workflow with Multiple Subfeature Vector Sizes  Input: Raw data ^^, Pretrained model ^^, Set of subfeature sizes ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon:   2. ^^^ ← ^^^^^^^ for each ^^^ ∈ ^^   [Transform inputs into feature vectors] 3. for each subfeature size ^^ௌி,^ ∈ ^^ do 4. Divide into Subfeature Vectors of size ^^ௌி,^:   5. Divide ^^ in^^to ^^^^^^^^      6. Compute Prototypes for Subfeature Vectors:  ^ 7. ^^^^ೕ ←ே^∑^:௬^ୀ^^^^^^^^^^  for each class ^^ and subfeature segment ^^   8. ClassificaƟon of Test Examples:  9. ^^௧^^௧ ← ^^^^^௧^^௧^ and divide into ^^^^^^௧^^^௧ೕ   10. For each test subfeature vector ^^^^^^௧^^^௧ೕ:   11. ^^ ^^^^^^^௧^^^௧ೕ,^^^^ೕ ^ ←∥ ^^^^^^ ^௧^^௧ೕ െ ^^^^ೕ ∥   12. ^^^௧^^௧ೕ ← arg min^^^ ^^^^^^^௧^^^௧ೕ,^^^^ೕ ^   ^^୮^ିௗ^ௌி^^ ೞ^ೞ^ೕ ,^^ೞೕ ^^13. ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ←ೞ ೞ   ∑^ᇲ ^^୮ ^ିௗ൬ௌி^^^ೞ^ೕ ,^^ᇲೕ ^^14.   end for  15.   VoƟng and Confidence AggregaƟon:   16. Collect all ^^௧^^^௧ೕ and ^^^^^^^^^^^^^^^^^^^^^^^^^^ for each ^^ௌி,^   17. ^^௧^^௧ ← mode of ^^௧^^^௧ೕ   18. Confidence^^^^ ← average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^

[0135] As  for algorithm 2  the  confidence value Confidence^^^^ is  set as  the average of  the confidence values for the various subfeature vectors SFVStest,j  / sub‐classifiers.

[0136] Following algorithm 3, the flow diagram of figure 6 comprises the following steps:   100: Inputting a pretrained foundation model F and raw data X into the workflow  /  software,  wherein the raw data X comprises a support dataset xi (including available individual classes c and sizes of each subfeature vectors sSF,j) and a test dataset xtest.  200: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi, ftest involves sizes having a number of features  /   dimensions si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000.  The  size  si  for  each  support  feature  vector  is  typically  equal  to  the  size  stest  for  the corresponding test feature vector.   600: Classifying test subfeature vector and computing corresponding confidence scores for each  subfeature size sSF,j, wherein step 600 comprises 610: Dividing  the  support  feature  vector  fi  and  the  extracted  test  feature  vector  ftest  into  a number of support subfeature vectors SFVi,j of sizes sSF,j and a number of test subfeature vectors  SFVtest,j of sizes sSF,test. Each size sSF,test of the test subfeature vectors SFVtest,j corresponds to an  equal size sSF,j of the support subfeature vectors SFVi,j.     620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   630: Computing confidence score confidencej(c) of each test subfeature vector SFVtest,j and each  of the chosen individual classes c chosen in step 620.   700: Performing voting of the test subfeature vectors SFVtest,j to determine a resulting class ytest.  The voting may be a majority voting or a weighted voting.   800: Outputting the resulting class ytest of the test dataset xtest.

[0137] Figure 7 schematically illustrates the classification approach according to the inventive  method disclosed in Figure 6 and exemplified in algorithm 3. As for the example shown in Figures 3 and 5, the test  image xtest may be classified  into two classes, class 1 (pc=1) and class 2 (pc=2). After classification of each  test subfeature vector SFVtest,j  (for example based on prototypical  networks PN method involving calculating sub‐prototypes pc,j of the support subfeature vectors  SFVi,j), voting are performed on the different subfeature vectors SFVi,j  /  sub‐classifiers to find an optimized  class  ytest  for  the  test  dataset  xtest.  Further,  the  corresponding  confidence  score Confidence(c)  is calculated by averaging the confidence scores of each test subfeature vector Confidencej(c).

[0138] In order to further enhance the precision and effectiveness of the innovative method,  advanced sorting technique may be employed for the features of the original support feature  vectors fi, before dividing them into subfeature vectors SFVsij.

[0139] The sorting ensures that features in feature vectors fi, ftest having similar characteristics  are grouped into a common cluster, thereby contributing to mitigate the potential influence of  outliers or features having extraordinary large distances during the final classification decision  (see specific example below). Such characteristics may be of statistical and / or semantic nature.  By treating each feature dimension as an individual entity, unsupervised clustering algorithms  can be applied to organize features into coherent groups based on their similarity profiles.  For  example to recognize a car, features recognizing wheels, car doors, car shapes, car windows etc.  are needed and these features should ideally be placed in the same cluster.

[0140] Such strategic sorting process may be achieved by sorting  the  features s  in  feature (pc) between  prototypes pc.

[0141] As mentioned previously other sorting techniques can be envisaged, such as applying  constrained k‐means clustering, standard k‐means, spectral clustering, hierarchical clustering  with depth control, Gaussian Mixture Models (GMMs) with a fixed number of components or  randomization‐based sorting.

[0142] Common  for  these  methods  is  that  they  enable  grouping  of  features  /   feature dimensions  based  on  their  mutual  similarities,  for  example  defined  by  distance  metrics (Euclidean, cosine, etc.), correlations, or learned embeddings.

[0143] When the feature vectors fi are divided into subfeature vectors SFVsi,j, features s having  such similarities are as a consequence found within the same subfeature vectors SFVsij.   Standard Deviation Sorting

[0144] Standard deviation sorting involves calculating the standard deviation ^ of the features  within the support feature vectors fi and subsequently sort the derived standard deviations ^(fi)  to achieve sorted indices. Finally, the features within the feature vectors fi are sorted according  to these sorted indices leading to a more coherent contributions to the classification process.

[0145] The weight / influence of  individual  features with exceptionally high or  low standard deviations are thus reduced during the overall decision‐making. Note that any quantisation of  ‘exceptionally high or low standard deviations’ must be decided for each task and is governed  by the goal of achieving an optimal clustering of features with similar standard deviations, and  thus avoiding erroneous classification decisions.

[0146] Algorithm 4  shown below provides an example of how  the  calculation of  standard deviation ^j may be programmed across all feature vectors fnew  in support set Fsupport and the subsequent sorting.   Algorithm 4 Feature Vector SorƟng Based on Standard DeviaƟon in Support Set  Input: Support set feature vectors Fsupport, New feature vector ^^^^௪  Output: Sorted feature vector ^^^^^௧^ௗ  1. Compute standard deviaƟon ^j for each feature j across all feature vectors fi in Fsupport  2. Sort indices based on standard deviaƟon: ^^^^^௧^ௗ ← indices_sorted_by(^^^) 3. Sort ^^^^௪ using ^^^^^௧^ௗ to get ^^^^^௧^ௗ  Distance Sorting in Prototypical Networks PN method

[0147] In  the  distance  sorting  methodology,  the  distances  between  prototypes  pc  are emphasized in the calculation, whether it be for binary classification scenarios involving positive  class (e.g. defect class) and negative class (e.g. non‐defect class) or for cases with more than two  classes.

[0148] For each prototype  feature  /  dimension,  the  average distance davg(fi) between  the prototypes pc are calculated  for each dimension separately, taking  into account all  individual classes  c.  These  average  distances  davg  are  then  used  as  the  basis  for  sorting  the  features, resulting in sorted indices Isorted.

[0149] Subsequently, these sorted indices Isorted are employed to organize the features within  the feature vectors fi.

[0150] This  approach  effectively  groups  features  with  similar  average  distances  together, ensuring  a  balanced  and  controlled  impact  of  features  with  extreme  distances  during  the classification process, regardless of the number of classes involved.

[0151] Algorithm  5  shown  below  provides  an  example  of  how  distance  and  subsequent sorting may be programmed.   Algorithm 5 Feature Vector SorƟng Based on Average Prototype Feature Distance  Input: Set of prototypes P = {^^^, ^^ଶ, … , ^^^}, New feature vector ^^^^௪ Output: Sorted feature vector ^^^^^௧^ௗ  4. Compute average distance ^^^ for each feature j across all prototypes in P  5. Sort indices based on average distance: ^^^^^௧^ௗ ← indices_sorted_by(^^^) 6. Sort ^^^^௪ using ^^^^^௧^ௗ to get ^^^^^௧^ௗ  Sorting based on Clustering

[0152] Another effective technique involves applying constrained k‐means clustering, which  clusters the features s of the feature vector fi,ftest into a fixed number of groups j equal to the  desired number of sub‐feature vectors SFVsij.

[0153] Algorithm 6 shown below provides an example of how  the  feature vector  fi can be sorted based on such a constrained k‐means clustering.  Algorithm 6 Feature Vector SorƟng Based on Constrained Clustering  Input: Support set feature vectors Fsupport, group size s, new feature vector fnew  Output: Sorted feature vector fsorted  1. Stack all support feature vectors (fi) or test feature vectors (ftest) and transpose to obtain  shape (D,N), where D is the number of feature dimensions  /  features and N is the number  of support feature vectors (fi) or test feature vectors (ftest)  2. Compute number of groups: j ← D / s, where s is the desired size of each sub‐feature vector  3. Apply constrained clustering (e.g., k‐means with fixed group size s) to cluster D feature  dimensions into j groups  4. (clusters)  5. Sort fnew using Isorted to get fsorted  Randomization‐Based Sorting Techniques

[0154] Feature  sorting  can also be achieved  through  random permutations of  the  feature vector dimensions, followed by the evaluation of each permutation using performance‐based or  statistical criteria.

[0155] Algorithm 7 shown below provides an example of how  the  feature vector  fi can be sorted based on random permutations.  Algorithm 7 Feature Vector Sorting Based on Random Permutations Input:  Support  set  feature  vectors  Fsupport,  validation  set  feature  vectors  Fval  (optional), new feature vector fnew, group size s, number of trials NT  Output: Sorted feature vector fsorted  1. Initialize best score as negative infinity and Ibest as None  2. For nT= 1 to NT do 3.   Generate a random permutation It of feature indices 4.   Apply it to reorder feature vectors in Fsupport and, if available, Fval 5.   Split each feature vector into sub‐feature vectors of size s   6. Choose one of the following scoring strategies:  7. Validation Performance: If available set feature vectors Fval, evaluate, classification  accuracy on Fval using the current permutation; use accuracy as the score  Support Set Statistics: For each sub‐feature vector, compute a statistical metric (e.g.,  group std); then apply a scoring function (e.g., total std, std of stds, or a combination)  8. If the score is better than the current best, update Ibest  ←  It  9.  end for  10.  Sort fnew using Ibest to get fsorted

[0156] The same sorting techniques may be used for test feature vectors ftest.

[0157] Hence, by incorporating an array of sorting techniques such as the sorting techniques mentioned above  into  the  inventive method significantly enhances  the model's capability  to discern intricate relationships within the data.

[0158] This enhancement not only mitigates the influence of outlier features but also ensures  a comprehensive analysis of feature interdependencies.

[0159] By meticulously  organizing  the  features  prior  to  segmenting  them  into  subfeature vectors SFVsi,j, the methodology has the capability of harnessing the full potential of the feature  sets, irrespective whether or not the subfeature vectors sSF,j are of equal or dissimilar sizes.

[0160] As indicated above, the framework is inherently designed to accommodate a diverse spectrum  of  sorting  techniques.  These  include,  but  are  not  limited  to,  sorting  based  on correlation  between  features / dimensions,  weighted  feature  importance  (as  determined  by various  feature selection algorithms), and other statistical or machine  learning‐based sorting methodologies.

[0161] Algorithm  8  shown  below  provides  a  detailed  example  of  how  division  into  sub‐classifiers of possibly different sizes sSF,j may be made after sorting of features  /  dimensions using  a specific sorting technique t from a set of sorting techniques T (e.g. by at least one of standard deviation,  distance,  constrained  k‐means  clustering,  standard  k‐means,  spectral  clustering, hierarchical clustering with depth control, and Gaussian Mixture Models (GMMs) with a fixed  number of components) and subsequent voting of the generated sub‐classifiers.   Algorithm 8 Enhanced Workflow with Subfeature Vector Sizes and SorƟng  Input: Raw data ^^, Pretrained model ^^, Set of subfeature sizes ^^, Corresponding sorting  techniques ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon:  2. ^^^ ← ^^^^^^^ for each ^^^ ∈ ^^   [Transform inputs into feature vectors] 3. for each subfeature size sSF,j ∈ ^^ do  4. Get corresponding sorƟng technique ^^ from ^^ for size sSF,j  5. Sort Feature Vectors (if ^^ is not ‘keep original order’):   6. Apply sorƟng technique ^^ on ^^^ to get ^^^௧   7. Divide into subfeature vectors of size sSF,j:   8. Divide ^^^௧ into ^^^^^^^^^      [Subfeature vectors of size sSF,j] 9. Compute Prototypes for Subfeature Vectors:   ^ 10. ^^^^^^^^^^ 11. 12. ^^௧௧^^௧← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   13. For each test subfeature vector ^^^^^^௧^^^௧ೕ:   14. ^^ ^^^^^^^௧^^^௧ೕ,^^^ ^^ೕ ^ ←∥ ^^^^^^௧^^௧ೕ െ ^^^^ೕ ∥  15. ^^^௧^^௧ೕ ← arg min^^^ ^^^^^^^௧^^^௧^ೕ ,^^^ೕ^  ^^୮^ିௗ^ௌி^^ ೞ^ೞ^ೕ ,^^ೞೕ ^^16. ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ←   ∑^ᇲ ^^୮ ^ିௗ൬ௌி^^ ೞ^ೞ^ೕ ,^^ ೞᇲೕ ^^17.   end for  18.   VoƟng and Confidence AggregaƟon:   19. Collect all ^^௧^^^௧ೕ and ^^^^^^^^^^^^^^^^^^^^^^^^^^ for each sSF,j  20. ^^௧^^௧ ← mode of ^^௧^^^௧ೕ   21. Confidence^^^^ ← average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^

[0162] Following algorithm 8, the flow diagram of Figure 8 comprises the following steps:   100: Inputting a pretrained foundation model F, raw data X and sorting technique set T into the workflow  /   software.  The  raw  data  X  comprises  a  support  dataset  xi  (including  available individual classes c and sizes of each subfeature vectors sSF,j) and a test dataset xtest. The sorting  technique set T comprises one or more specific sorting techniques t for sorting feature vectors  extracted by the pretrained foundation model F in step 200.  200: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi, ftest involves sizes having a number of features  /   dimensions si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000.  The  size  si  for  each  support  feature  vector  is  typically  equal  to  the  size  stest  for  the corresponding test feature vector.   500: Sorting the feature vectors extracted in step 200 according to selected sorting technique t,  for example based on standard deviations ^j or based on average distances davg.    600: Classifying test subfeature vector SFVtest,j and computing corresponding confidence scores  Confidencej(c) for each subfeature size, wherein step 600 comprises  610: Dividing the extracted support feature vector fi and the extracted test feature vector ftest  into a number of support subfeature vectors SFVi,j of sizes sIF,i and a number of test subfeature  vectors SFVtest,j of sizes sSF,test. Each size sSF,test of the test subfeature vectors SFVtest,j corresponds  to an equal size sSF,j of the support subfeature vectors SFVi,j.     620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   630: Computing confidence score Confidencej(c) of each test subfeature vector SFVtest,j and each  of the chosen individual classes c chosen in step 710.   700: Performing voting of the test subfeature vectors SFVtest,j to determine a resulting class ytest  and averaging corresponding confidence values Confidencej(c). The voting may be a majority  voting or a weighted voting.   800: Outputting the resulting class ytest of the test dataset xtest and corresponding confidence  score Confidence(c).  Weight assignment for subfeature vectors of varying sizes sSF,j

[0163] In an exemplary embodiment the subfeature vectors SFVsi,j, SFVstest,j extracted from the  feature vectors fi, ftest may be assigned different weights w based on their sizes sSF,j in order to  optimize the few‐shot learning.

[0164] These weights w may then be applied both  in  the voting process and  in calculating confidence scores.

[0165] During weighing, larger subfeature vectors, i.e. containing more features / dimensions,  may receive higher weights then smaller subfeature vectors, and vice versa. Weighing may also  be determined through empirical experiments, e.g. by picking out some values and choosing the  optimal value for each task (similar to parameter tuning during training of a foundation model).

[0166] Such  weighing  ensures  a  more  balanced  and  accurate  contribution  to  the  final classification,  thereby  enhancing  the  reliability  of  confidence  scores,  particularly  in  high‐dimensional data scenarios.

[0167] Moreover,  the  weighing  embodiment  offers  flexibility  in  weight  adjustments  for different datasets, thus enhancing its versatility and effectiveness.

[0168] The algorithm 9 shown below provides a detailed example of how division into sub‐classifiers  of  different  sized  subfeature  vectors  SFtest,j,  SFij  may  be  made  after  sorting  and subsequent voting (see previous description).  Algorithm 9 Enhanced Workflow with Subfeature Vector Sizes, SorƟng, and Weights  Input: Raw data ^^, Pretrained model ^^, Set of subfeature sizes ^^, Corresponding sorƟng  techniques ^^, Corresponding weights ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon:  2. ^^^ ← ^^^^^^^ for each ^^^ ∈ ^^   [Transform inputs into feature vectors] 3. for each subfeature size ^^ௌி,^ ∈ ^^ do  4. Get corresponding sorƟng technique ^^ from ^^ and weight ^^ from ^^ for size ^^   5. Sort Feature Vectors (if ^^ is not ‘keep original order’):   6. 7. 8. Divide ^^^௧ into ^^^^^^^^^      [Subfeature vectors of size sSF,j] 9. Compute Prototypes for Subfeature Vectors:  0. ^^^^ 1 ← ^ ^ೕ ^^^^^^ 11. 12. ^^௧௧^^௧← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   13. For each test subfeature vector ^^^^^^௧^^^௧ೕ:  14. ^^ ^^^^^^^௧^^ ^^^௧^ೕ ,^^^ೕ ^ ←∥ ^^^^^^௧^^௧ೕ െ ^^^ೕ∥   15. ^^^௧^^௧ೕ ← arg min^^^ ^^^^^^^௧^^^௧ೕ,^^^^ೕ ^   ^^୮^ିௗ^ௌி^ೞ ,^^ೞ ^^^ ^^ೞ^^ ^ ೕ ೕ16. ^^^^^^^^^^^^^^^^^^^^^ ^^ ← ^^ ൈ   ∑^ᇲ ^^୮ ^ିௗ൬ௌி^^ ೞ^ೞ^ೕ ,^^ ೞᇲೕ ^^17.   end for  18.   Weighted VoƟng and Confidence AggregaƟon:   19. Collect all weighted ^^௧^^^௧^ೕ  and ^^^^^^^^^^^^^^^^^^^^^^^^^ for each sSF,j  20. ^^ ← weigh ^௧^^௧ ted mode of ^^௧^^௧ೕ    [VoƟng  based  on  weighted  subfeature  /  subdimension classificaƟons]  21. Confidence^^^^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^

[0169] Following algorithm 9, the flow diagram of Figure 9 comprises the following steps:   100: Inputting a pretrained foundation model F, raw data X, sorting technique set T and weight set W  into the workflow  /  software. The raw data X comprises a support dataset xi (including available  individual classes c and sizes of each subfeature vectors sSF,j) and a test dataset xtest. The  sorting  technique  set T  comprises one or more  specific  sorting  techniques  t  for  sorting feature vectors extracted by the pretrained foundation model F in step 200. The weight set W  comprises desired weights modifying the voting of the sub‐classifiers and the confidence scores.  200: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi,ftest involves sizes having a number of features  /   dimensions si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000.  The  size  si  for  each  support  feature  vector  is  typically  equal  to  the  size  stest  for  the corresponding test feature vector.   500: Sorting the feature vectors extracted in step 200 according to selected sorting technique t,  for example based on standard deviations ^j or based on average distances davg.    600: Classifying each test subfeature vector SFVtest,j and computing corresponding confidence  scores ConfidencejI for each subfeature size, wherein step 600 comprises  610: Dividing the extracted support feature vector fi and the extracted test feature vector ftest  into a number of support subfeature vectors SFVi,j of sizes sSF,j and a number of test subfeature  vectors SFVtest,j of sizes sSF,test. Each size sSF,test of the test subfeature vectors SFVtest,j corresponds  to an equal size sSF,j of the support subfeature vectors SFVi,j. 620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   630: Computing weighted confidence score Confidencej(c) of each test subfeature vector SFVtest,j  and each of the chosen individual classes c chosen in step 620, wherein the degree of weight is  set by the weight set W.  700: Performing weighted voting of the test subfeature vectors SFVtest,j to determine a resulting  class ytest and weighted averaging corresponding confidence values Confidencej(c). The voting  may be a majority voting and / or a weighted voting, wherein the degree of weight is set by the  weight set W.   800: Outputting the resulting class ytest of the test dataset xtest and corresponding confidence  score Confidence(c).  Addressing the loss of global feature relationships

[0170] By combining advanced  feature extraction capabilities of  foundation models F with simplicity and effectiveness of distance metrics based methods such as PNs as described above,  these inventive methods offer a powerful solution for few‐shot learning tasks, enabling accurate  and efficient classification with limited data.

[0171] However,  another  notable  challenge with  dividing  feature  vectors  into  subfeature vectors is the potential loss of global feature relationships.

[0172] This particular challenge may be mitigated by performing the additional steps of   ‐multiplying  (for example duplicating) the original feature vectors  fi and ftest  into n*fi and n*ftest, respectively and   ‐ dividing the duplicated vectors into differently sized subfeature vectors SFVi,j determined  through  empirical  experimentations / tests  for  each  task  to  be  solved.,  wherein  such empirical experimentation is performed to ensure that optimized sizes of the subfeature  vectors SFVSi,j,SFVStest,j are continuously employed.   Selection of sub‐classifiers

[0173] In another exemplary embodiment a selective approach of using sub‐classifiers are  provided, where only those with the highest confidence scores may be considered. The overall  model reliability is thus enhanced since only the most accurate classifiers are considered.

[0174] The  algorithm  10  shown  below  provides  a  detailed  example  of  implementing  the embodiment with pre‐selection of sub‐classifiers for voting (see in particular lines 20‐22) .  Algorithm  10  Enhanced  Workflow  with  Subfeature  Vector  Sizes,  Sorting,  Weights,  and  Top‐performing Sub‐classifier Selection  Input: Raw data ^^, Pretrained model ^^, Subfeature sizes ^^, SorƟng techniques ^^, Weights  ^^, Percentage ^^ for top sub‐classifiers   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon:  2. ^^^ ← ^^^^^^^ for each ^^^ ∈ ^^   [Transform inputs into feature vectors] 3. IniƟalize list SubClassifiers for storing tuples of ^^^௧^^^௧ೕ,^^^^^^^^^^^^^^^^^^^^^^^^^^,^^^   4. for each subfeature size ^^ௌி,^ ∈ ^^ do  5. Get corresponding sorƟng technique ^^ and weight ^^ for size ^^ௌி,^   6. Sort Feature Vectors (if ^^ is not ‘keep original order’):   7. Apply sorƟng technique ^^ on ^^^ to get ^^^௧   8. Divide into Subfeature Vectors of size ^^ௌி,^ :   9. Divide ^^௧ into ^^^^^^^^^^    [Subfeature vectors of size ^^ௌி,^] 10. Compute Prototypes for Subfeature Vectors:  ^ 11. ^^^←^^^^^^^ 12. 13. ^^௧௧^^௧← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   14. For each subfeature vector ^^^^^^௧^^^௧ೕ:   ^^ ^^^^^^^^^ ^ ^^^^^^ ^ ^^^ 20.   Select Top‐performing Sub‐classifiers:   21. Sort SubClassifiers based on ^^^^^^^^^^^^^^^^^^^^^^^^^^ in descending order   22. Select top ^^% of SubClassifiers to form SelectedClassifiers   23.   Weighted VoƟng and Confidence AggregaƟon:   24. Collect all ^^௧^^^௧ೕand ^^^^^^^^^^^^^^^^^^^^^^^^^^ from SelectedClassifiers   25. ^^௧^^௧ ← weighted mode of ^^ ^௧^^௧ೕ    [VoƟng based on selected classifiers] 26. Confidence^^^^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^ from  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[0175] As  seen  in  lines  24  and  26,  the  predicted  class  ytest  and  the  confidence  score Confidence(c) is based on SelectedClassifiers.

[0176] Following algorithm 10, the flow diagram of Figure 10 comprises the following steps:   100: Inputting a pretrained foundation model F, raw data X, sorting technique set T, weight set W  and  Selection Percentage %P  into  the workflow  /   software.  The  raw data X  comprises  a support dataset xi (including available individual classes c and sizes of each subfeature vectors  sSF,j) and a test dataset xtest. The sorting technique set T comprises one or more specific sorting  techniques t for sorting feature vectors extracted by the pretrained foundation model F in step  200. The weight set W comprises desired weights modifying the voting of the sub‐classifiers and the  confidence  scores.  The  selection  percentage  %P  provides  information  which  part  of  a generated sub‐classifier list that shall be selected prior to determining the selected class ytest and  the corresponding confidence score Confidence(c).   200: Performing feature extraction of the support dataset xi and the test dataset xtest using the  pretrained foundation model F, thus generating a support feature vector fi and a test feature  vector ftest, respectively. Both feature vectors fi, ftest involve sizes having a number of features  /   dimensions si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000.  The  size  si  for  each  support  feature  vector  is  typically  equal  to  the  size  stest  for  the corresponding test feature vector.  400.  Initializing a sub‐classifier  list SubClassifiers for storing tuples of predicted class for each test subfeature vector, c, corresponding confidence score Confidencej(c) and weight w.  500: Sorting the feature vectors extracted in step 200 according to selected sorting technique t,  for example based on standard deviations ^j or based on average distances davg.    600: Classifying each test subfeature vector SFVtest,j and computing corresponding confidence  scores Confidencej(c) for each subfeature size sSF,j, wherein step 600 comprises  610: Dividing the extracted support feature vector fi and the extracted test feature vector ftest  into a number of support subfeature vectors SFVi,j of sizes sSF,j and a number of test subfeature  vectors SFVtest,j of sizes sSF,test. Each size sSF,test of the test subfeature vectors SFVtest,j corresponds  to an equal size sSF,j of the support subfeature vectors SFVi,j. 620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   630: Computing weighted confidence score Confidencej(c) of each test subfeature vector SFVtest,j  and each of the chosen individual classes c chosen in step 620, wherein the degree of weight is  set by the weight set W. 640:  Updating  sub‐classifier  list  SubClassifiers  with  determined  class  c,  confidence  score Confidencej(c) and weight w.   700: Performing weighted voting of the test subfeature vectors SFVtest,j to determine a resulting  class ytest and weighted averaging corresponding confidence values Confidencej(c). The voting  may be a majority voting and / or a weighted voting, wherein the degree of weight is set by the  weight set W.   800: Outputting the resulting class ytest of the test dataset xtest and corresponding confidence  score Confidence(c).

[0177] Note again that sequence of certain steps may be changed without jeopardizing the  results. E.g. the sorting step may be performed after the dividing step.

[0178] Figure  11  schematically  illustrates  the  classification  approach  according  to  the inventive method disclosed  in Figure 10 and exemplified  in algorithm 10. As for the example shown in Figures 3, 5 and 7, the test image xtest may be classified into two classes, class 1 (pc=1) and  class  2  (pc=2).  The  subsequent  voting  however  is  performed  only  among  Sub‐Classifiers having  the  highest  confidence  scores,  wherein  the  selection  criteria  are  set  by  the predetermined selection percentage %P. If the determined list of sub‐classifiers are sorted by  descending confidence scores, the selection percentage %P is preferably a top part of the sub‐ classifier list.    Combining features from multiple foundation models

[0179] As schematically illustrated in Figure 12, a further extension of the inventive method  described above may involves combining feature vectors fi, ftest from multiple foundation models  F1…Fn into more comprehensive vectors. For example, support images xi and test images xtest of  power line components such as isolators as exemplified in the top part of Figure 12 may be fed into a  set of n different  foundation models  F,  thereby extracting at  least n  support  feature vectors fi,n and at least n test feature vectors ftest,n. Two or more of these support feature vectors  fi,n, ftest,n are then concatenated into larger support and test feature vectors.

[0180] Algorithm  11  shown  below  provides  a  detailed  example  of  implementing  the classification  method  using  multiple  foundation  models,  wherein  Fset  symbolize  a  set  of  n foundation models F.  Algorithm  11  Enhanced  Workflow  with  Multiple  Feature  Extractors,  Subfeature  Vector  Sizes, Sorting, Weights, and Top‐performing Sub‐classifier Selection  Input: Raw data ^^, Set of pretrained models ^^^^௧, Subfeature sizes ^^, SorƟng techniques ^^,  Weights ^^, Percentage ^^ for top sub‐classifiers   Output: Predicted class ytest, Confidence scores Confidence^^^^   1. Feature ExtracƟon and Merging:  2. For each model ^^ ∈ ^^^^௧:  3. ^^ி ∈ ^^  4. ←concatenate൫^^^ி^ |^^ ∈ ^^^^௧^൯   5. Normalize Merged Feature Vectors:   6. 7. Normalize: ^^^   8.^^^௧ೕ,^^^^^^^^^^^^^^^^^^^^^^^^^^,^^^  9. for each subfeature size ^^ௌி,^ ∈ ^^ do  10. Get corresponding sorƟng technique ^^ and weight ^^ for size ^^ௌி,^  11. Sort Feature Vectors (if ^^ is not ‘keep original order’):   12. Apply sorƟng technique ^^ on ^^^ to get ^^^௧  13. Divide into Subfeature Vectors of size ^^ௌி,^:   14. Divide ^^^௧ into ^^^^^^^^^    [Subfeature vectors of size ^^ௌி,^] 15. Compute Prototypes for Subfeature Vectors:   ^ 16. ^^^←^^^^^^^ 17. 18. ^^௧௧^^௧← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   19. For each subfeature vector ^^^^^^௧^^^௧ೕ: 20. ^^ ^^^^^^^௧^^ ^^^௧^ೕ ,^^^ೕ ^ ←∥ ^^^^^^௧^^௧ೕ െ ^^^ೕ∥   21. ^^^௧^^௧ೕ ← arg min^^^ ^^^^^^^௧^^^௧^ೕ ,^^^ೕ^   ^^୮^ିௗ^ௌி^ೞ^ ,^^ೞ ^^22. ^^^^^^^^^^^^^^^^^^^^^ ^ೞ^^ ^^^ ೕ ೕ^ ← ^^ ൈೞ ೞ   ∑^ᇲ ^^୮ ^ିௗ൬ௌி^^^ೞ^ೕ ,^^ᇲೕ ^^23. Add ^^^௧^^^௧^ೕ ,^^^^^^^^^^^^^^^^^^^^^^^^^,^^^ to ^^^^^^^^^^^^^^^^^^^^^^^^^^^^   24.  end for   25.  Select Top‐performing Sub‐classifiers:   26. Sort ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ based on ^^^^^^^^^^^^^^^^^^^^^^^^^^^ௗ^ in descending order   27. Select top ^^% of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to form ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   28.  Weighted VoƟng and Confidence AggregaƟon:   29. Collect all ^^௧^^^௧ೕand ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  30. ^^௧^^௧ ← weighted mode of ^^ ^௧^^௧ೕ    [VoƟng based on selected classifiers] 31. Confidence^^^^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^ from  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[0181] In this exemplary classification method the features are normalized by their mean and  standard deviation (see lines 5‐7). This normalization ensures that all features are on the same  scale which is often of importance for maintaining the integrity and accuracy of the combined vector.  Such  a  normalization  step may  be  significant when  dealing with  diverse  foundation models, as it harmonizes the varied feature ranges into a consistent format, allowing for more  effective application of this approach.

[0182] Following algorithm 11, the flow diagram of Figure 13 comprises the following steps:   100: Inputting a pretrained foundation model set Fset, raw data X, sorting technique set T, weight  set W and Selection Percentage %P into the workflow  /  software. The foundation model set Fset comprises a plurality of  foundation models F. The raw data X comprises a support dataset xi (including  available  individual  classes  c and  sizes of  each  subfeature  vectors  sSF,j)  and  a  test dataset xtest. The sorting technique set T comprises one or more specific sorting techniques t for  sorting feature vectors extracted by the pretrained foundation model F in step 200. The weight  set W comprises desired weights modifying the voting of the sub‐classifiers and the confidence scores.  The  selection  percentage  %P  provides  information  which  part  of  a  generated  sub‐classifier  list  that  shall  be  selected  prior  to  determining  the  selected  class  ytest  and  the corresponding confidence score Confidence(c).   200: Performing feature extraction of the support dataset xi and the test dataset xtest using each of  the  pretrained  foundation  models  F  in  the  foundation model  set  Fset,  thus  generating  a plurality of support feature vectors fFi and a plurality of test feature vectors fFtest, respectively. Both  feature  vectors  fFi,fFtest  involve  sizes  having  a  number  of  features  /   dimensions  si,stest, wherein si and stest are positive integers of 1 or more, for example 10, 100 or 1000. The size si for  each support feature vector is typically equal to the size stest for the corresponding test feature  vector.  300. Merging  feature  vectors  fFi,fFtest  from  all  foundation models  into  concatenated  feature vectors fi,ftest. 400.  Initializing a sub‐classifier  list SubClassifiers for storing tuples of predicted class for each test subfeature vector, c, corresponding confidence score Confidencej(c) and weight w. 500: Sorting the feature vectors fi,ftest concatenated  in step 300 according to selected sorting technique  t,  for example based on  standard deviations ^j or on average distances davg. The sorting step may also involve duplication of the feature vectors as described above.   600: Classifying each test subfeature vector SFVtest,j and computing corresponding confidence  scores Confidencej(c) for each subfeature size sSF,j, wherein step 600 comprises  610: Dividing the extracted support feature vector fi and the extracted test feature vector ftest  into a number of support subfeature vectors SFVi,j of sizes sSF,j and a number of test subfeature  vectors SFVtest,j of sizes sSF,test. Each size sSF,test of the test subfeature vectors SFVtest,j corresponds  to an equal size sSF,j of the support subfeature vectors SFVi,j. 620: Classifying each of the test subfeature vectors SFVtest,j  into at  least some of the available individual classes c specified in the support dataset xi by applying one or more of the distance  metrics‐based methods such as a prototypical networks PN method or a nearest sub‐centroid  NSC method.   630: Computing weighted confidence score Confidencej(c) of each test subfeature vector SFVtest,j  and each of the chosen individual classes c chosen in step 710, wherein the degree of weight is  set by the weight set W. 640:  Updating  sub‐classifier  list  SubClassifiers  with  determined  class  c,  confidence  score Confidencej(c) and weight w.   700: Performing weighted voting of the test subfeature vectors SFVtest,j from selected parts of the sub‐classifier  list SubClassifiers to determine a resulting class ytest and weighted averaging corresponding confidence values Confidencej(c). The voting may be a majority voting and / or a  weighted voting, wherein the degree of weight is set by the weight set W.   800: Outputting the resulting class ytest of the test dataset xtest and corresponding confidence  score Confidence(c).

[0183] Integrating  multiple  foundation  models  from  various  providers  into  a  few‐shot learning  system  substantially  enhances  its  performance  and  reliability  through  several  key mechanisms:  ‐Diverse  Training  Data  Sets:  Each  model,  developed  by  different  providers,  is  typically trained on distinct datasets, often optimized  for  specific  tasks.  This diversity ensures  a broader coverage of scenarios, enhancing the model's generalizability and reducing biases  inherent in any single dataset.  ‐ Algorithmic Diversity: Employing models built with different algorithms and configurations  enriches the overall system by pooling a wide range of analytical approaches and feature  extractions. This leads to a more comprehensive feature set, ideal for tackling various tasks  effectively.  ‐ Robustness and Error Handling: The combination of multiple models increases the overall  resilience of  the system, allowing  it  to maintain performance even  if one model  fails or encounters  anomalies.  This  redundancy  is  important  for  maintaining  reliability  in applications where precision is vital.  ‐ Enhanced Feature Extraction: By aggregating insights from several foundation models, the  system gains a deeper and more nuanced understanding of the data, capturing subtleties  that might be missed by a single model. This results in superior predictive accuracy and a  richer analysis capability.

[0184] These  strategic  benefits  make  the  integration  of  multiple  foundation  models  a powerful  approach  in  few‐shot  learning,  ensuring  that  the  system  not  only  performs  with enhanced accuracy and reliability but also adapts effectively to a wide range of complex and  evolving tasks.

[0185] With  these  enhancements,  the  novel  classification  methods  provide  significant improvements in accuracy for few‐shot learning models in high‐dimensional data scenarios.

[0186] Its broad applicability  includes  fields with  limited  training data, offering a nuanced solution for AI‐based inspections and diagnostics.

[0187] The integration of features from multiple foundation models leads to a richer feature  set, improving classification accuracy in complex tasks and enriching overall analysis accuracy.

[0188] Additionally, the framework's adaptability to various classification methods, such as  nearest neighbor and centroid classifications, further amplifies its potential.

[0189] This flexibility, coupled with the ability to adeptly navigate high‐dimensional spaces,  makes it a versatile tool, enhancing precision and insight in a multitude of advanced analytical  applications.

[0190] Below, three additional exemplary algorithms (algorithms 12 to 14) are presented, all  using multiple feature extractors, where algorithm 12 performs the classification using nearest neighbor  based  approach  for  the  subfeature  vectors, while  algorithms  13  and  14  compute nearest centroid approach and sub‐centroids approach for the subfeature vectors SFVi,j, SFVtest,j,  respectively.   Algorithm 12 Enhanced Workflow with Multiple Feature Extractors and Neighbor‐Based Strategies  Input: Raw data ^^, Set of pretrained models ^^^^௧, Subfeature sizes ^^, SorƟng techniques ^^,  Weights ^^, Percentage ^^ for top sub classifiers, Neighbor strategy ^^^^, Number of neighbors  ^^ or radius ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon and Merging:  2. For each model ^^ ∈ ^^^^௧:  3. ^^ி^ ← ^^^^^^^ for each ^^^ ∈ ^^  4. Merge feature vectors from all models: ^^ ி^ ← concatenate൫^^^^ |^^ ∈ ^^^^௧^൯  5. Normalize Merged Feature Vectors:   6. Compute mean ^^^^^^^ and standard deviaƟon ^^^^^^^ for ^^^   ^ 7. Normalize: ^^^^^^^ ← 8. ^ ^^c^,^^^  9. for each subfeature size ^^ ௌி,^ ∈ ^^ do  10. Get corresponding sorƟng technique ^^, weight ^^, and neighbor strategy ^^^^ for size     11. (if ^^ is not ’keep original order’):   12. Apply sorƟng technique ^^ on ^^^ to get ^^^௧   13. Divide into Subfeature Vectors of size ^^ௌி,^:   14. Divide ^^^௧ into ^^^^^^^^^    15. ClassificaƟon of Test Examples:  16. ^^௧௧^^௧ ← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   17. for each subfeature segment ^^:   18. if ^^^^ is k‐NN then 19. Find ^^ nearest neighbors ^^^^^^ ^^^^^^^௧^^^௧ೕ^ in training data   20. ^^^௧^^௧ೕ ← majority class among ^^^^^^ ^^^^^^^௧^^^௧ೕ^   21. else if ^^^^ is Radius Neighbors then 22. Find all neighbors within radius ^^: ^^^^^^ ^^^^^^^௧^^^௧ೕ^   23. ^^^௧^^௧ೕ ← majority class among ^^^^^^ ^^^^^^^௧^^^௧ೕ^   24. end if  2 29. end for  30. Select Top‐performing Sub Classifiers:   31. Sort ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ based on ^^^^^^^^^^^^^^^^^^^^^^^^^^ in descending order  32. Select top ^^% of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to form ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   33. Weighted VoƟng and Confidence AggregaƟon:   34. Collect all ^^௧^^^௧^ೕ  and ^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  35. ^^௧^^௧ ← weighted mode of ^^௧^^^௧ೕ  36. Confidence^^^௧^^௧^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Algorithm 13 Enhanced Workflow with Multiple Feature Extractors and Nearest Centroid Strategy   Input: Raw data ^^, Set of pretrained models ^^^^௧, Subfeature sizes ^^, SorƟng techniques ^^,  Weights ^^, Percentage ^^ for top sub classifiers   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon and Merging:   2. For each model ^^ ∈ ^^^^௧: 3. ^^ி^ ← ^^^^^^^ for each ^^^ ∈ ^^  4. Merge feature vectors from all models: ^^^ ← concatenate൫^^^ி^ |^^ ∈ ^^^^௧^൯  5. Normalize Merged Feature Vectors:   6. Compute mean ^^^^^^^ and standard deviaƟon ^^^^^^^ for ^^^   ^ 7. Normalize: ^^^ିఓ^^^^^ ←ఙ^^^^   8.^^9. for each subfeature size ^^ ௌி,^ ∈ ^^ do  10. Get corresponding sorƟng technique ^^ and weight ^^ for size ^^SF,j   11. Sort Feature Vectors (if ^^ is not ’keep original order’):   12. Apply sorƟng technique ^^ on ^^^ to get ^^^௧   13. Divide into Subfeature Vectors of size ^^ௌி,^:   14. Divide ^^^௧ into ^^^^^^^^^    15. Compute Centroids for Subfeatures:   16. Compute  centroid ^^^^ ←^^^ ^ೕ ^^^^ class ^^ and  subfeature  segment ^^   17. ClassificaƟon of Test Examples:   18. ^^௧௧^^௧ ← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   19. for each test subfeature vector ^^^^^^௧^^^௧ೕ:   20. Find nearest centroid ^^^^ ^^^^^^^^^^21. ^^^ ← clas^ ௧^^௧ೕ s of ^^^^ ^^^^^^^௧^^௧ೕ^   22. Compute distance ^^ ^^^^^^^௧^^^௧^ೕ ,^^^ೕ^   ^^୮^ିௗ^ௌி^^ ೞ ,^^ೞ ^^^^^^^^^^^^^^^^^^^^^ ^ೞ^ೕ ೕ23. ^^^ ^^^^ ← ^^ ൈ   ∑^ᇲ ^^୮ ^ିௗ൬ௌி^^ ೞ^ೞ^ೕ ,^^ ೞᇲೕ ^^24. Add ^^^௧^^^௧ೕ,^^^^^^^^^^^^^^^^^^^^^^^^^^,^^^ to ^^^^^^^^^^^^^^^^^^^^^^^^^^^^   25. end for  26. end for  27. Select Top‐performing Sub‐ Classifiers:   28. Sort ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ based on ^^^^^^^^^^^^^^^^^^^^^^^^^^ in descending order  29. Select top ^^% of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to form ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   30. Weighted VoƟng and Confidence AggregaƟon:   31. Collect all ^^௧^^^௧ೕ and ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  32. ^^௧^^௧ ← weighted mode of ^^௧^^^௧ೕ   33. Confidence^^^^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Algorithm 14 Enhanced Workflow with Sub‐Centroids Multiple Feature Extractors  Input: Raw data ^^, Set of pretrained models ^^^^௧, Subfeature sizes ^^, SorƟng techniques ^^,   Weights ^^, Percentage ^^% for top sub‐classifiers, Number of sub‐centroids per class ^^   Output: Predicted class ^^௧^^௧, Confidence scores Confidence^^^^   1. Feature ExtracƟon and Merging:   2. For each model ^^ ∈ ^^^^௧:  3. ^^ி^ ← ^^^^^^^ for each ^^^ ∈ ^^  4. Merge feature vectors from all models: ^^^ ← concatenate൫^^^ி^ |^^ ∈ ^^^^௧^൯  5. Normalize Merged Feature Vectors:   6. Compute mean ^^^^^^^ and standard deviaƟon ^^^^^^^ for ^^^   ^ 7. Normalize: ^^^^^^^ ← 8. ^௨^^^^௧^^^ௗೕ,^^^^^^^^^^^^^^^^^^^^^^^^^^,^^^   9. for each subfeature size ^^ௌி,^ ∈ ^^ do  10. Get corresponding sorƟng technique ^^, weight ^^, and number of sub‐centroids ^^  for size ^^ௌி,^   11. Sort Feature Vectors (if ^^ is not ’keep original order’):   12. Apply sorƟng technique ^^ on ^^^ to get ^^^௧   13. Divide into Subfeature Vectors of size ^^ௌி,^:  14. Divide ^^^௧ into ^^^^^^^^,^   15. Compute Sub‐Centroids for Subfeatures:   16. Perform clustering within each class to find ^^ sub‐centroids: ^^^^^^ೕೖ for each  class ^^ andsubfeature segment ^^  17. ClassificaƟon of Test Examples:   18. ^^௧௧^^௧ ← sorted ^^^^^௧^^௧^ using technique ^^ and divide into ^^^^^^௧^^^௧ೕ   19. for each test subfeature vector ^^^^^^௧^^^௧ೕ:   20. Find nearest sub‐centroid ^^^^^^ ^^^^^^^௧^^^௧ೕ^ among ^^^^^^ೕೖ   21. ^^^௧^^௧ೕ ← class of ^^^^^^ ^^^^^^^௧^^^௧ೕ^   22. Compute distance ^^ ൬^^^^^^௧^^^௧^ೕ ,^^^^^^^^^^^^^^௧^^௧ೕ^^ for each class  26. end for  27. Select Top‐performing Sub‐Classifiers:   28. Sort ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ based on ^^^^^^^^^^^^^^^^^^^^^^^^^^ in descending order 29. Select top ^^% of ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to form ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   30. Weighted VoƟng and Confidence AggregaƟon:   31. Collect all ^^௧^^^௧ೕ and ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   32. ^^௧^^௧ ← weighted mode of ^^௧^^^௧ೕ   33. Confidence^^^^ ← weighted average of corresponding ^^^^^^^^^^^^^^^^^^^^^^^^^^ from ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[0191] As shown in algorithm 14, each class can be represented by multiple sub‐centroids to  enhance classification precision. Various methods can be used to define these sub‐centroids:  ‐ Manual Grouping: Choosing sub‐centroids based on expert insight and recognizable data  patterns.  ‐ Feature Function Grouping: Grouping feature vectors based on statistical functions like  mean or variance to form sub‐centroids.  ‐ Difficulty‐Based Grouping: Segmenting data into sub‐centroids based on the difficulty of  classification, helping to focus on more challenging or ambiguous areas within each class.  ‐ K‐Means Clustering: Utilizing K‐means to automatically segment class features into  clusters, each represented by a centroid.  ‐ Hierarchical Clustering: Applying hierarchical clustering to determine sub‐centroids by  building a tree of clusters and selecting appropriate levels.  ‐ Density‐Based Clustering (e.g., DBSCAN): Identifying dense regions of data points to  establish sub‐centroids based on local density.  ‐ Random Sampling: Randomly sampling subsets of data points within each class to serve as  temporary sub‐centroids for exploratory analysis or iterative refinement.

[0192] The following is a non‐exhaustive list of dataset types that may be classified using the  above described inventive methods.   ‐ Image Data: Datasets comprised of digital images can be utilized in applications such as the  classification of defects in manufacturing processes and general inspections, identification  of  specific  medical  conditions  through  diagnostic  imaging,  and  automated  species identification in biodiversity studies.  ‐ Audio Data: Comprising sound recordings, these datasets can be applied to tasks such as  detecting mechanical failures through anomalous noise patterns in industrial equipment,  identifying distress calls in emergency response systems, and classifying music genres for  digital media platforms.  ‐Video  Data:  Datasets  of  video  recordings  are  applicable  in  scenarios  like  monitoring manufacturing  lines  for quality control  through defect  recognition, analysing pedestrian behaviour  in  urban  planning  studies,  and  detecting  anomalous  behaviours  in  security footage for public safety.  ‐ Text Data: Consisting of textual content, these datasets can be leveraged for applications  such as  sentiment analysis  in customer  feedback  to  improve product or  service quality, classification of  legal documents for automated  jurisprudence systems, and detection of phishing attempts in cybersecurity measures.

[0193] The  inventive method  accommodates  these diverse  types of datasets by  primarily altering  the  foundation  model  used  for  feature  extraction.  For  each  dataset  type,  a corresponding  foundation  model  is  selected  to  effectively  transform  raw  data  into  feature vectors.

[0194] Once the appropriate foundation model extracts the feature vectors, the subsequent  steps in the few‐shot learning process—such as calculating distances, forming prototypes or sub‐ centroids, and classifying through voting mechanisms—remain consistent regardless of the data type.  This  uniformity  ensures  that  the  inventive  methods  retain  their  effectiveness  while offering  the  flexibility  to  shift  between  different  dataset  types  as  required  by  specific applications, thus making them highly adaptable solutions in diverse technological and industrial  environments.

[0195] As a practical example, ISIC (International Skin Imaging Collaboration) training dataset  from the following link were applied using algorithm 11, but without the normalization step.   https: / / challenge.isic‐archive.com / data / #2018 (training data)

[0196] The experiment used Prototypical Networks PN with Euclidean distance in the 5 shot scenarios  within  training  episodes  containing  10  test  images  and  5  classes,  AKIEC  (actinic keratosis), DF (dermatofibroma), MEL (melanoma), NV (melanocytic nevi) and VASC (vascular).  The accuracy result follows the 5‐way classification accuracy approach.

[0197] The following three feature extractors were used: Meta’s Dinov2‐small, Google’s VIT‐large‐patch16‐224,  OpenAI’s  CLIP‐Vit‐base‐patch16.  Features  from  these  extractors  were combined  into  one  feature  vector  of  the  support  image  and  the  test  image,  without normalization.

[0198] The feature vector was then divided into subfeature vectors SFVi,j, SFVtest,j having two  subvector sizes sSF,j: 2 and 16. For subvector size of sSF,j = 2, the original order of the features was  kept. For subvector size of 16, the features were ordered by standard deviation ^i of the features  in the support dataset xi. w = 2 and 16 were the weights for the two subvectors SFVi,2, SFVi,16, SFVtest,2,  SFVtest,16.  P%  =  30%  of  the  sub‐classifiers  with  the  highest  confidence  scores  were selected.

[0199] With these settings the 5‐way classification accuracy increased from 55.64% to 61.86%  compared to the results achieved by using the prior art algorithm (algorithm 1) with identical  input data.

[0200] Various  embodiments  of  the  disclosure  relate  to  methods  that  are  computer‐ implemented. Each step of the disclosed methods may be performed by a computer in the most  general sense of the term, meaning any device capable of performing the data processing steps of  the  method,  including  dedicated  digital  circuits.  The  computer  may  comprise  various combinations  of  known  computer  elements,  including  for  example  CPUs,  RAM,  SSDs, motherboards, network connections, firmware, software, and / or other elements known in the art  that  allow  the  computer  to  perform  the  required  computing  operations.  The  required computing operations may be defined by one or more computer programs. The one or more computer programs may be provided  in  the  form of media or data  carriers, optionally non‐transitory  media,  storing  computer  readable  instructions.  When  the  computer  readable instructions are read by the computer, the computer performs the required method steps. The  computer may consist of a self‐contained unit, such as a general‐purpose desktop computer,  laptop, tablet, mobile telephone, or other smart device. Alternatively, the computer may consist  of a distributed computing system having plural different computers connected to each other  via a network such as the internet or an intranet.

Claims

CLAIMS  1. A computer‐implemented method for classifying test dataset (xtest), comprising the steps of:  A: (100) receiving input data comprising classification dataset (X) comprising    a support dataset (xi) including input classes (yi) of the support dataset (xi), a number of individual classes (c) for classification and the test dataset (xtest),   a subfeature size set (S) comprising a number of subvector segments (j) and    a pretrained model set (Fset) comprising at least one pretrained model (F); B: (200) performing feature extraction of the support dataset (xi) and the test dataset (xtest) of the  classification dataset (X) using the pretrained model set (Fset) to generate support feature vectors  (fi) and test feature vectors (ftest), respectively;  C: (600,610) in accordance with the number of subvector segments (j) within the subfeature size  set (S), dividing each support feature vector (fi) into a plurality of support subfeature vectors (SFVi,j)  and each test feature vector (ftest) into a plurality of test subfeature vectors (SFVtest,j), respectively,  wherein each of the subfeature vectors (SFVi,j,SFVtest,j) contain at least one subvector feature (sSF,j); D: for each test subfeature segment (j), (620)  implementing at  least one distance metrics‐based method involving    the test subfeature vector (SFVtest,j) and    at least one of the support subfeature vectors (SFVi,j)  to assign the subfeature vector (SFVtest,j) to a specific individual class (c), and E:  (700,800)  performing  voting  of  the  test  subfeature  vectors  (SFVtest,j)  based  on  the  assigned individual classes (c) to determine a predicted class (ytest) for the test dataset (xtest).

2. The computer‐implemented method according  to claim 1, wherein  the at  least one distance metrics‐based method  in  step D  for determining  an  individual  class  (c)  for  the  test  subfeature vectors (SFVtest,j) comprises at least one of ‐ prototypical networks (PN)  involving calculating sub‐prototypes (pc_j) of the support subfeature vectors (SFVi,j) and finding minimum distance (dminj) between the test subfeature vectors (SFVtest,j)  and the sub‐prototypes (pc_j), ‐ nearest neighbors  (NN)  involving calculating k nearest neighbors and / or all neighbors within a radius r from each test subfeature vector (SFVtest,j),  ‐ nearest  centroids  (NC)  involving calculating centroids  (Cc_j)  for  the  support  subfeature vectors (SFVi,j) and finding the centroid (Cc_j) nearest to the test subfeature vector (SFVtest,j) and  ‐  nearest  sub‐centroids  (NSC)  in  which  a  plurality  of  determined  sub‐centroids  (SCc_j)  of  each individual class (c) are applied to find the nearest sub‐centroid (NSCc_j) to the test subfeature vector  (SFVtest,j).

3. The computer‐implemented method according to claim 1 or 2, wherein   step D further comprises  ‐ (630) calculating confidence scores (Confidencej(c)) of each test subfeature vector (SFVtest,j) and  each individual class (c) and  step E further comprises  ‐ (700,800) collecting and averaging the confidence scores (Confidencej(c)) for the respective test subfeature  vectors  (SFVtest,j)  to  determine  a  predicted  confidence  score  (Confidence(c))  for  the predicted class (ytest) of the test dataset (xtest).

4. The computer‐implemented method according to any one of the preceding claims,  ‐ wherein  the subfeature vectors  (SFVi,j,SFVtest,j) corresponding  to  two or more of  the subvector segments (j) have dissimilar number of subvector features (sSF,j).

5. The computer‐implemented method according to any one of the preceding claims,   wherein the input data in step A further comprises    ‐ a sorting technique set (T) comprising at least one sorting technique (t),  ‐ wherein the step B further comprises    ‐ (500) choosing a sorting technique (t) from the sorting technique set (T);    ‐ (500) generating a number of sorting  indices equaling the number of features  in the support feature vectors (fi) and   ‐ (500) sorting the support feature vectors (fi) and the test feature vectors to the chosen sorting technique (t) and the generated sorting indices.

6. The computer‐implemented method according to claim 5, wherein the sorting technique set (T)  comprises    ‐ computing standard deviation (^sort) for      features of the support feature vectors (fi) or a function of the support feature vectors (fi) and / or      features of the test feature vectors   ‐  (500) sorting based on    to generate  the sorted support feature vectors (fi) and the sorted test feature vectors (ftest).

7. The computer‐implemented method according to claim 5 or 6, wherein the sorting technique set  (T) comprises    ‐  computing distance  (dsort) between  features of  the  support  feature  vectors  (fi) or  a function of the support feature vectors (fi) and / or features of the test feature vectors (ftest) and    ‐ (500) sorting based on the distance (dsort) or a function of the distance (dsort) to generate sorted support feature vectors (fi) and sorted test feature vectors (ftest).

8. The computer‐implemented method according to any one of the preceding claims,   ‐ wherein the input data in step A further comprises    ‐ a weight factor set (W) and ‐ (800) wherein at least one of the individual classes (c) assigned in step D is weighted with at least  one weight factor (w) among the weights factor set (W) when determining the predicted class (ytest)  in step E.

9. The computer‐implemented method according to claim 8, when dependent on claim 3,   ‐ (630) wherein at least one of the calculated confidence values (Confidencej(c)) is weighted with at  least one weight factor (w) among the weights factor set (W).

10. The computer‐implemented method according to any one of the preceding claims,   ‐ wherein the method further comprises    (400) initializing a list of sub‐classifiers (SubClassifiers); ‐ wherein the input data in step A further comprises    a  selection  percentage  (P%)  for  selecting  a  specific  part  of  the  list  of  sub‐classifiers (SubClassifiers), and  ‐ wherein step D further comprises    ‐  (640)  updating  the  list  of  sub‐classifiers  (SubClassifiers)  with  at  least  the  assigned individual classes (c),    ‐  (640)  sorting  the  list of  sub‐classifiers  (SubClassifiers) based on at  least one  type of parameters for each test subfeature vector (SFVtest,j) generated by the at least one distance metrics‐ based method and   ‐ (640) selecting the specific part of sub‐classifiers (SelectedSubClassifiers) among the list of sub‐classifiers (SubClassifiers) by use of the selection percentage (P%).

11. The  computer‐implemented  method  according  to  any  one  of  the  preceding  claims,  when dependent on claim 3,   ‐ wherein the method further comprises    (400) initializing a list of sub‐classifiers (SubClassifiers); ‐ wherein the input data in step A further comprises    a selection percentage (P%) for selecting a top part and / or a bottom part of a list of sub‐classifiers (SubClassifiers), and  ‐ wherein step D further comprises    ‐  (640)  updating  the  list  of  sub‐classifiers  (SubClassifiers)  with  at  least  the  assigned individual  classes  (c)  and  the  confidence  values  (Confidencej(c))  generated  by  the  at  least  one distance metrics‐based method,    ‐ (640) sorting the list of sub‐classifiers (SubClassifiers) based on at least the confidence values (Confidencej(c)) in descending or ascending order and   ‐ (640) selecting a top part and / or a bottom part of sub‐classifiers (SelectedSubClassifiers) among the list of sub‐classifiers (SubClassifiers) by use of the selection percentage (P%).

12. The computer‐implemented method according to any one of the preceding claims,  ‐  wherein  if  in step A a pretrained model set (Fset)  is chosen comprising a plurality of pretrained models (F), then    the feature extraction of the support dataset (xi) and the test dataset (xtest) generating a plurality of support feature vectors (fi) and a plurality of test feature vectors (ftest), respectively, are  performed for at least two of the pretrained models (F) and  ‐ wherein step B further comprises   ‐  (300) merging  the  plurality  of  the  support  feature  vectors  (fi)  into  a  concatenated support feature vector (fi) and the plurality of the test feature vectors (ftest) into a concatenated test  feature vector (ftest),   ‐ wherein the concatenated support feature vectors (fi) and the concatenated test feature vector  (ftest) are employed in steps C and D.

13. The computer‐implemented method according to claim 12, wherein the method comprises the  steps of  - verifying compatibility of the at least two of the pretrained models (F) and  - deciding if a normalization between the at least two pretrained models (F) is desirable,   if the decision is affirmative, normalize each of the concatenated support feature vectors (fi) and  each of the concatenated test feature vectors (ftest) extracted in step B by a normalization process  comprising   - calculating means (µ(fi),µ(ftest)) and standard deviations (^(fi),^(ftest)) and  - normalizing using the means (µ(fi),µ(ftest)) and the standard deviations (^(fi),^(ftest)).

14. The computer‐implemented method according to any one of the preceding claims, wherein step  C further comprises    ‐  calculating  sub‐prototypes  (pc_j)  for  each  individual  class  (c)  and  each  support subfeature vector (SFVi,j), and  wherein step D further comprises   ‐  calculating  for  each  test  subfeature  vector  (SFVtest,j)  and  each  individual  class  (c)  a distance (dj) between the test subfeature vector (SFVtest,j) and the sub‐prototype (pc_j),   ‐ determining a minimum distance (dminj) among the calculated distances (dj) and   ‐ setting the  individual class (c) of the test subfeature vector (SFVtest,j) to the  individual class (c) corresponding to the minimum distance (dminj).

15. A  computer‐readable  storage medium  comprising  instructions which, when  executed  by  a computer,  cause  the  computer  to  carry  out  the  steps  of  the  computer‐implementer  method according to any one of claims 1‐14.

Citation Information

Patent Citations

  • Learning proxy mixtures for few-shot classification

    US20230111287A1

  • Scalable feature stream

    US20230351721A1

Cited By

  • Risk prediction method for thyroid hyperspectral image based on quality control and uncertainty

    CN122435417A