for p in training_paths:
    image = cv2.imread(p)
gray = cv2.cvtColor(image, cv2.CV_LOAD_IMAGE_GRAYSCALE)
kp, dsc = sift.detectAndCompute(gray, None)
BOW.add(dsc)
dictionary = BOW.cluster()
Python Bag of Words clustering