Bag classifier for classifying sets of object instances
[WBAG,WOBJ] = BAGC(A,OBJCLASSF,BAGINDEX,BAGCOMBC,BAGCLASSF,BAGLAB)
This routine offers a classifier for bags (e.g. images) of objects (e.g. pixels) stored in a single dataset. The objects in the training set A should have at least two labels: bag labels (the class of their bag) and bag indices, defining which objects belong to the same bag. These two label sets should be stored by the ADDLABELS command in the dataset A. Refer to the multi-labeling system (see MULTI_LABELING) offered by PRTools. The current object labels of A can be the bag labels, but may also be different, e.g. true object labels.
BAGINDEX should be a label_list_name or a label_list_index defining the label list used for storing the bag indices that refer to the bag an object belongs to. The same label_list_name or label_list_index should be used for defining the bags of the test objects in B.
All objects in A are used to train the object classifier OBJCLASSF if it is untrained. The current object labels are used for that. Classification results of the objects in the same bag are combined by BAGCOMBC, which can be any of the fixed combiners MEANC, PRODC, PERC, MAXC, etcetera. This results for every bag in a single confidence vector for the classes.
If an untrained bag classifier BAGCLASSF is supplied, the bag confidence vectors are used to train a bag classifier.
New bags, organised in a dataset like B, with the proper bag indices per object stored in a label list with the same name or label_list_index as used in A, can be classified by the bag classifier WBAG.
If no bag classifier BAGCLASSF was defined during training, just the results of the object classifier WOBJ are returned combined by BAGCOMBC over the objects in the same bag in B. In this case the final result is identical to B*(A*WOBJ)*BAGCC(,BAGCOMBC), provided that A has class labels and B is labeled by its bag indices.