test-classifier.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:simple-recognition 作者: peixebabel 项目源码 文件源码
def testClassifier():
    clf = pickle.load(open("classifier.p", "rb"))
    classes = numpy.loadtxt(dataset_root + 'classes.txt', dtype=str)
    classes = column(classes, 0)

    image_files = sorted(listdir(
        join(project_root, test_images_dir)))
    for image in image_files:
        features = extractFeatures(
            str(abspath(join(project_root, test_images_dir, image))))
        prediction = clf.predict(features)
        img = mpimg.imread(
            str(abspath(join(project_root, test_images_dir, image))))
        fig = plt.figure()
        fig.suptitle(classes[int(prediction[0])],
                     fontsize=14, fontweight='bold')
        plt.imshow(img)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号