Git Product home page Git Product logo

book's Issues

PIL报错ImportError: The _imagingft C module is not installed

在使用VScode调试object_detection_example_1.py报错The _imagingft C module is not installed
Traceback (most recent call last):
File "e:\MY_PROGRAME\tf_train\object_detection_example_1.py", line 114, in
line_thickness=8)
File "E:\MY_PROGRAME\tf_train\models\research\object_detection\utils\visualization_utils.py", line 744, in visualize_boxes_and_labels_on_image_array
use_normalized_coordinates=use_normalized_coordinates)
File "E:\MY_PROGRAME\tf_train\models\research\object_detection\utils\visualization_utils.py", line 128, in draw_bounding_box_on_image_array
use_normalized_coordinates)
File "E:\MY_PROGRAME\tf_train\models\research\object_detection\utils\visualization_utils.py", line 175, in draw_bounding_box_on_image
font = ImageFont.truetype('arial.ttf', 24)
File "D:\Anaconda3\envs\TensorPyTorch\lib\site-packages\PIL\ImageFont.py", line 853, in truetype
return freetype(font)
File "D:\Anaconda3\envs\TensorPyTorch\lib\site-packages\PIL\ImageFont.py", line 850, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "D:\Anaconda3\envs\TensorPyTorch\lib\site-packages\PIL\ImageFont.py", line 185, in init
if core.HAVE_RAQM:
File "D:\Anaconda3\envs\TensorPyTorch\lib\site-packages\PIL\ImageFont.py", line 44, in getattr
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed

但是在pycharm下运行正常???请问是啥原因。
python是3.6版本的

关于第三章一键训练模型的一些问题。

老师您好,感谢您百忙之中查看此问题。
在学习完书中第三章一键训练模型后,我成功的实现了一键训练猫狗识别的程序。于是我尝试着使用我自己的训练集,按照您的方法对图片进行标注以及训练模型。我成功的完成了模型的训练,也保存了冻结图文件,但是当我运行object_detection_example_2文件,即想看模型对于测试集的训练效果时,运行程序时命令行窗口显示如下错误。Traceback (most recent call last):
File "object_detection_example_2.py", line 11, in
from utils import label_map_util
File "D:\tf_train\models\research\object_detection\utils\label_map_util.py", line 21, in
from object_detection.protos import string_int_label_map_pb2
File "D:\tf_train\workspaces\weights_training_dome1\object_detection.py", line 12, in
from utils import visualization_utils as vis_util
File "D:\tf_train\models\research\object_detection\utils\visualization_utils.py", line 36, in
from object_detection.core import standard_fields as fields
ModuleNotFoundError: No module named 'object_detection.core'; 'object_detection' is not a package

我尝试了网上参考的解决方法,但是没有找到问题的原因。
后来我多次反复在控制台输入 python object_detection_example_2.py又成功执行了test图片的预测。我也不知道为什么会发生这样的事情,希望老师可以指点我一下。

编译proto文件 出错了。。。

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>for /f %i in ('dir /b *.proto') do protoc %i --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc anchor_generator.proto --python_out=.
object_detection/protos/grid_anchor_generator.proto: File not found.
object_detection/protos/ssd_anchor_generator.proto: File not found.
object_detection/protos/multiscale_anchor_generator.proto: File not found.
anchor_generator.proto:5:1: Import "object_detection/protos/grid_anchor_generator.proto" was not found or had errors.
anchor_generator.proto:6:1: Import "object_detection/protos/ssd_anchor_generator.proto" was not found or had errors.
anchor_generator.proto:7:1: Import "object_detection/protos/multiscale_anchor_generator.proto" was not found or had errors.
anchor_generator.proto:13:5: "GridAnchorGenerator" is not defined.
anchor_generator.proto:14:5: "SsdAnchorGenerator" is not defined.
anchor_generator.proto:15:5: "MultiscaleAnchorGenerator" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc argmax_matcher.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc bipartite_matcher.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc box_coder.proto --python_out=.
object_detection/protos/faster_rcnn_box_coder.proto: File not found.
object_detection/protos/keypoint_box_coder.proto: File not found.
object_detection/protos/mean_stddev_box_coder.proto: File not found.
object_detection/protos/square_box_coder.proto: File not found.
box_coder.proto:5:1: Import "object_detection/protos/faster_rcnn_box_coder.proto" was not found or had errors.
box_coder.proto:6:1: Import "object_detection/protos/keypoint_box_coder.proto" was not found or had errors.
box_coder.proto:7:1: Import "object_detection/protos/mean_stddev_box_coder.proto" was not found or had errors.
box_coder.proto:8:1: Import "object_detection/protos/square_box_coder.proto" was not found or had errors.
box_coder.proto:14:5: "FasterRcnnBoxCoder" is not defined.
box_coder.proto:15:5: "MeanStddevBoxCoder" is not defined.
box_coder.proto:16:5: "SquareBoxCoder" is not defined.
box_coder.proto:17:5: "KeypointBoxCoder" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc box_predictor.proto --python_out=.
object_detection/protos/hyperparams.proto: File not found.
box_predictor.proto:5:1: Import "object_detection/protos/hyperparams.proto" was not found or had errors.
box_predictor.proto:23:12: "Hyperparams" is not defined.
box_predictor.proto:66:12: "Hyperparams" is not defined.
box_predictor.proto:126:12: "Hyperparams" is not defined.
box_predictor.proto:138:12: "Hyperparams" is not defined.
box_predictor.proto:174:12: "Hyperparams" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc eval.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc faster_rcnn.proto --python_out=.
object_detection/protos/anchor_generator.proto: File not found.
object_detection/protos/box_predictor.proto: File not found.
object_detection/protos/hyperparams.proto: File not found.
object_detection/protos/image_resizer.proto: File not found.
object_detection/protos/losses.proto: File not found.
object_detection/protos/post_processing.proto: File not found.
faster_rcnn.proto:5:1: Import "object_detection/protos/anchor_generator.proto" was not found or had errors.
faster_rcnn.proto:6:1: Import "object_detection/protos/box_predictor.proto" was not found or had errors.
faster_rcnn.proto:7:1: Import "object_detection/protos/hyperparams.proto" was not found or had errors.
faster_rcnn.proto:8:1: Import "object_detection/protos/image_resizer.proto" was not found or had errors.
faster_rcnn.proto:9:1: Import "object_detection/protos/losses.proto" was not found or had errors.
faster_rcnn.proto:10:1: Import "object_detection/protos/post_processing.proto" was not found or had errors.
faster_rcnn.proto:29:12: "ImageResizer" is not defined.
faster_rcnn.proto:38:12: "AnchorGenerator" is not defined.
faster_rcnn.proto:45:12: "Hyperparams" is not defined.
faster_rcnn.proto:98:12: "BoxPredictor" is not defined.
faster_rcnn.proto:111:12: "PostProcessing" is not defined.
faster_rcnn.proto:126:12: "HardExampleMiner" is not defined.
faster_rcnn.proto:133:12: "ClassificationLoss" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc faster_rcnn_box_coder.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc graph_rewriter.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc grid_anchor_generator.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc hyperparams.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc image_resizer.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc input_reader.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc keypoint_box_coder.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc losses.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc matcher.proto --python_out=.
object_detection/protos/argmax_matcher.proto: File not found.
object_detection/protos/bipartite_matcher.proto: File not found.
matcher.proto:5:1: Import "object_detection/protos/argmax_matcher.proto" was not found or had errors.
matcher.proto:6:1: Import "object_detection/protos/bipartite_matcher.proto" was not found or had errors.
matcher.proto:12:5: "ArgMaxMatcher" is not defined.
matcher.proto:13:5: "BipartiteMatcher" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc mean_stddev_box_coder.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc model.proto --python_out=.
object_detection/protos/faster_rcnn.proto: File not found.
object_detection/protos/ssd.proto: File not found.
model.proto:5:1: Import "object_detection/protos/faster_rcnn.proto" was not found or had errors.
model.proto:6:1: Import "object_detection/protos/ssd.proto" was not found or had errors.
model.proto:11:5: "FasterRcnn" is not defined.
model.proto:12:5: "Ssd" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc multiscale_anchor_generator.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc optimizer.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc pipeline.proto --python_out=.
object_detection/protos/eval.proto: File not found.
object_detection/protos/graph_rewriter.proto: File not found.
object_detection/protos/input_reader.proto: File not found.
object_detection/protos/model.proto: File not found.
object_detection/protos/train.proto: File not found.
pipeline.proto:5:1: Import "object_detection/protos/eval.proto" was not found or had errors.
pipeline.proto:6:1: Import "object_detection/protos/graph_rewriter.proto" was not found or had errors.
pipeline.proto:7:1: Import "object_detection/protos/input_reader.proto" was not found or had errors.
pipeline.proto:8:1: Import "object_detection/protos/model.proto" was not found or had errors.
pipeline.proto:9:1: Import "object_detection/protos/train.proto" was not found or had errors.
pipeline.proto:15:12: "DetectionModel" is not defined.
pipeline.proto:16:12: "TrainConfig" is not defined.
pipeline.proto:17:12: "InputReader" is not defined.
pipeline.proto:18:12: "EvalConfig" is not defined.
pipeline.proto:19:12: "InputReader" is not defined.
pipeline.proto:20:12: "GraphRewriter" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc post_processing.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc preprocessor.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc region_similarity_calculator.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc square_box_coder.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc ssd.proto --python_out=.
object_detection/protos/anchor_generator.proto: File not found.
object_detection/protos/box_coder.proto: File not found.
object_detection/protos/box_predictor.proto: File not found.
object_detection/protos/hyperparams.proto: File not found.
object_detection/protos/image_resizer.proto: File not found.
object_detection/protos/matcher.proto: File not found.
object_detection/protos/losses.proto: File not found.
object_detection/protos/post_processing.proto: File not found.
object_detection/protos/region_similarity_calculator.proto: File not found.
ssd.proto:4:1: Import "object_detection/protos/anchor_generator.proto" was not found or had errors.
ssd.proto:5:1: Import "object_detection/protos/box_coder.proto" was not found or had errors.
ssd.proto:6:1: Import "object_detection/protos/box_predictor.proto" was not found or had errors.
ssd.proto:7:1: Import "object_detection/protos/hyperparams.proto" was not found or had errors.
ssd.proto:8:1: Import "object_detection/protos/image_resizer.proto" was not found or had errors.
ssd.proto:9:1: Import "object_detection/protos/matcher.proto" was not found or had errors.
ssd.proto:10:1: Import "object_detection/protos/losses.proto" was not found or had errors.
ssd.proto:11:1: Import "object_detection/protos/post_processing.proto" was not found or had errors.
ssd.proto:12:1: Import "object_detection/protos/region_similarity_calculator.proto" was not found or had errors.
ssd.proto:134:14: "Hyperparams" is not defined.
ssd.proto:22:12: "ImageResizer" is not defined.
ssd.proto:28:12: "BoxCoder" is not defined.
ssd.proto:31:12: "Matcher" is not defined.
ssd.proto:34:12: "RegionSimilarityCalculator" is not defined.
ssd.proto:45:12: "BoxPredictor" is not defined.
ssd.proto:48:12: "AnchorGenerator" is not defined.
ssd.proto:51:12: "PostProcessing" is not defined.
ssd.proto:62:12: "Loss" is not defined.
ssd.proto:160:12: "Hyperparams" is not defined.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc ssd_anchor_generator.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc string_int_label_map.proto --python_out=.

(tf_gpu) D:\vrs\tf_train\models\research\object_detection\protos>protoc train.proto --python_out=.
object_detection/protos/optimizer.proto: File not found.
object_detection/protos/preprocessor.proto: File not found.
train.proto:5:1: Import "object_detection/protos/optimizer.proto" was not found or had errors.
train.proto:6:1: Import "object_detection/protos/preprocessor.proto" was not found or had errors.
train.proto:17:12: "PreprocessingStep" is not defined.
train.proto:26:12: "Optimizer" is not defined.

第四章 Python范例 import cv2 ImportError: DLL load failed: 找不到指定的模块

老师好!
4.13章我按照书中的内容配置好了环境变量
image
却依然不能import cv2
由于报错显示是__init__.py的import cv2出现问题,搜索了一些网上资料,可能的原因是opencv和python版本还有numpy的版本不匹配,但是我进行了确认应该没有问题。
image
所以目前找不到原因了,希望您能抽空解答,感谢!

训练自己图片出现异常

一、图片上多个重复框问题
我根据您书上的描述,自己选择了220张大货车和小轿车图片,每张图片大小为2064*1672,因此我在ssd_inception_v2_coco.config文件中设置了大小为长宽的1/2, 如下
image_resizer {
fixed_shape_resizer {
height: 836
width: 1032
}
}

训练结果为:
image
image
image
出现较多的框线,如何才能获取到正确的目标呢?

二、针对上面的图形,我将
ssd_inception_v2_coco.config文件中设置了大小为长宽的原始大小, 如下
image_resizer {
fixed_shape_resizer {
height: 1672
width: 2064
}
}
进行训练后,推断结果只能出现小轿车的情况,而没有出现大货车的推断,请问这个是怎么回事呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.