G-U-N / PyCIL

PyCIL: A Python Toolbox for Class-Incremental Learning
Other
815 stars 138 forks source link

A question about exemplar selection. #91

Closed MadadamXie closed 2 months ago

MadadamXie commented 2 months ago

hi guys, i am new to PyCIL and watching the source codes currently. i am really confuse about the key idea behind the selection of exemplars , following codes really confuse me. Maybe a hint please?

        # Select
            selected_exemplars = []
            exemplar_vectors = []
            for k in range(1, m+1):
                S = np.sum(exemplar_vectors, axis=0)  # [feature_dim] sum of selected exemplars vectors
                mu_p = (vectors + S) / k  # [n, feature_dim] sum to all vectors
                i = np.argmin(np.sqrt(np.sum((class_mean - mu_p) ** 2, axis=1)))
                selected_exemplars.append(np.array(data[i]))  # New object to avoid passing by inference
                exemplar_vectors.append(np.array(vectors[i]))  # New object to avoid passing by inference
                vectors = np.delete(vectors, i, axis=0)  # Remove it to avoid duplicative selection
                data = np.delete(data, i, axis=0)  # Remove it to avoid duplicative selection 
G-U-N commented 2 months ago

Thanks for the interest. Please refer to Algorithm 4 in iCaRL.

MadadamXie commented 2 months ago

Thanks for the interest. Please refer to Algorithm 4 in iCaRL.

thank you for your response.