我正在运行从本教程中获得的代码, 我正在尝试运行tensorflow对象检测api,所有代码都运行良好,如果运行所有调用,所有单元格都会运行良好,最后,我的图像被分类。
Buuut 有 1 个电池不能很好地工作,它可以工作,但不喜欢它必须工作。
当我用它训练我的模型时!python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
,启动tensorflow并开始训练,但它只运行3步、4步,有时20、21、23步,最后,谷歌colab^C在过程中设置了a
我永远无法完成我的培训,因为谷歌合作实验室关闭了我的流程,有人知道发生了什么吗?
我已经尝试使用 GPU 和 TPU 实例。
[...]
INFO:tensorflow:Restoring parameters from training/model.ckpt-0
I1022 20:41:48.368024 139794549495680 tf_logging.py:115] Restoring parameters from training/model.ckpt-0
INFO:tensorflow:Running local_init_op.
I1022 20:41:52.779153 139794549495680 tf_logging.py:115] Running local_init_op.
INFO:tensorflow:Done running local_init_op.
I1022 20:41:52.997912 139794549495680 tf_logging.py:115] Done running local_init_op.
INFO:tensorflow:Starting Session.
I1022 20:41:59.072830 139794549495680 tf_logging.py:115] Starting Session.
INFO:tensorflow:Saving checkpoint to path training/model.ckpt
I1022 20:41:59.245162 139793493063424 tf_logging.py:115] Saving checkpoint to path training/model.ckpt
INFO:tensorflow:Starting Queues.
I1022 …Run Code Online (Sandbox Code Playgroud) python object-detection tensorflow object-detection-api google-colaboratory
在评估 Tensorflow 的对象检测 API 中的实例分割模型时,我希望拥有自定义的指标列表,可以总结如下;
我目前测试的是通过调整 pycocotools 的 PythonAPI 中的一些代码以及 Tensorflow 研究模型中的附加指标文件来修改现有的 coco 评估指标。目前COCO评估的默认输出值如下
Precision/mAP
Precision/mAP@.50IOU
Precision/mAP@.75IOU
Precision/mAP (small)
Precision/mAP (medium)
Precision/mAP (large)
Recall/AR@1
Recall/AR@10
Recall/AR@100
Recall/AR@100 (small)
Recall/AR@100 (medium)
Recall/AR@100 (large)
Run Code Online (Sandbox Code Playgroud)
coco_detection_metrics所以我决定首先在我的领域使用eval_config.config文件里面用于训练
eval_config: {
metrics_set: "coco_detection_metrics"
}
Run Code Online (Sandbox Code Playgroud)
并通过向统计列表和统计摘要字典中添加更多项目来进行多次编辑cocoeval.py(cocotools.py与值的数量成比例),以获得所需的结果。出于演示目的,我仅展示一个示例,即在 IOU=0.5 的精度之上添加 IOU=0.55 的精度。
所以,这是cocoeval.pyCOCOeval中类的修改方法
def _summarizeDets():
stats[1] = _summarize(1, iouThr=.5, maxDets=self.params.maxDets[2])
stats[12] = _summarize(1, iouThr=.5, maxDets=self.params.maxDets[2])
Run Code Online (Sandbox Code Playgroud)
重现的确切命令:
python train.py --logtostderr --train_dir=./models/train --pipeline_config_path=mask_rcnn_inception_v2_coco.config
我正在尝试在我自己的数据集上训练 Mask-RCNN 模型(从在 COCO 上训练的模型进行微调),但是一旦填充了 shuffle 缓冲区,该过程就会终止。
在此之前,nvidia-smi 显示内存使用量约为 10669MB/11175MB,但 GPU 使用率仅为 1%。
我尝试调整以下 train_config 设置:
batch_size: 1
batch_queue_capacity: 10
num_batch_queue_threads: 4
prefetch_queue_capacity: 5
Run Code Online (Sandbox Code Playgroud)
对于 train_input_reader:
num_readers: 1
queue_capacity: 10
min_after_dequeue: 5
Run Code Online (Sandbox Code Playgroud)
我相信我的问题类似于TensorFlow Object Detection API - Out of Memory,但我使用的是 GPU 而不是 CPU。
我正在训练的图像比较大(2048*2048),但是我想避免缩小尺寸,因为要检测的对象非常小。我的训练集包含 400 张图像(在 .tfrecord 文件中)。 …
我已经更新到Tensorflow 1.9和最新的Object Detection API大师.当运行工作得很好以前(我认为1.6版)培训/评估会议,培训似乎继续如预期,但我只得到评估和度量一个图像(第一批).
在Tensorboard中,图像标记为"Detections_Left_Groundtruth_Right".评估步骤本身也发生得非常快,这让我相信这不仅仅是一个Tensorboard问题.
查看model_lib.py,我看到一些可疑代码(靠近第349行):
eval_images = (
features[fields.InputDataFields.original_image] if use_original_images
else features[fields.InputDataFields.image])
eval_dict = eval_util.result_dict_for_single_example(
eval_images[0:1],
features[inputs.HASH_KEY][0],
detections,
groundtruth,
class_agnostic=class_agnostic,
scale_to_absolute=True)
Run Code Online (Sandbox Code Playgroud)
这对我来说就像评估者总是在第一张图像上运行一次评估.有没有人看到和/或修复过这个?如果改变上述工作,我会更新.
我尝试使用 tf.estimator.train_and_evaluate() 方法从检查点重新训练 TF 对象检测 API 模型,该模型已经具有 .config 文件,用于训练管道,例如在 models/research/object_detection/model_main.py 中。它每 N 步或每 N 秒保存一次检查点。
但我只想保存一个最好的模型,比如在 Keras 中。有没有办法用 TF 对象检测 API 模型来做到这一点?也许是 tf.Estimator.train 的一些选项/回调或将检测 API 与 Keras 一起使用的某种方式?
python machine-learning computer-vision tensorflow object-detection-api
我正在研究一些与对象检测方法(YOLOv3、Faster-RCNN、RetinaNet 等)相关的东西,我需要在 VOC2007 和 VOC2012 上进行训练(当然使用预训练模型)。然而,当我阅读相关论文时,我没有看到人们描述他们是使用早期停止训练还是仅使用固定次数的迭代进行训练。如果他们使用提前停止,在停止之前设置了多少步?因为当我在停止前尝试 100 步时,结果非常糟糕。请帮助我,非常感谢。
我正在尝试开始使用 Tensorflow 2.0 Object Detection API。我按照官方教程完成了安装,并通过了所有测试。但是,当我尝试运行主模块时,我不断收到我不明白的错误消息。这是我运行它的方式:
python model_main_tf2.py --model_dir=ssd_resnet50_v1_fpn_640x640_coco17_tpu-8 --pipeline_config_path=ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/pipeline.config
Run Code Online (Sandbox Code Playgroud)
这是错误消息的开头:
Traceback (most recent call last):
File "model_main_tf2.py", line 113, in <module>
tf.compat.v1.app.run()
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "model_main_tf2.py", line 110, in main
record_summaries=FLAGS.record_summaries)
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/object_detection/model_lib_v2.py", line 569, in train_loop
unpad_groundtruth_tensors)
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/object_detection/model_lib_v2.py", line 383, in load_fine_tune_checkpoint
ckpt.restore(checkpoint_path).assert_existing_objects_matched()
File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/tensorflow/python/training/tracking/util.py", line 791, in assert_existing_objects_matched
(list(unused_python_objects),)) …Run Code Online (Sandbox Code Playgroud) python deep-learning tensorflow object-detection-api tensorflow2.0
我已经使用 Tensorflow 2 对象检测 API 训练了 SSD ResNet V1 模型。然后我想在 C++ 代码中将这个模型与 OpenCV 一起使用。
首先,训练后我有三个文件:
请注意,我没有 .meta 文件,因为它不是生成的。
然后我使用exporter_main_v2.py对象检测 API 中的脚本从这些文件创建了 SavedModel :
python3 exporter_main_v2.py input_type=image_tensor --pipeline_config_path /path/to/pipeline.config --trained_checkpoint_dir=/path/to/checkouts --output_directory=/path/to/output/directory
Run Code Online (Sandbox Code Playgroud)
运行此脚本后,我得到了 saved_model.pb
我试图以这种方式在 OpenCV 中使用这个文件:
cv::dnn::Net net = cv::dnn::readNetFromTensorflow("/path/to/saved_model.pb");
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
OpenCV(4.2.0) /home/andrew/opencv/modules/dnn/src/tensorflow/tf_io.cpp:42: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse GraphDef file: /home/andrew/Documents/tensorflow_detection/workspace/pb_model/saved_model/saved_model.pb in function 'ReadTFNetParamsFromBinaryFileOrDie'
Run Code Online (Sandbox Code Playgroud)
然后我尝试冻结saved_model.pb。但是,据我所知,在 TF2.x 中这是不可能的,因为 TF2.x 不支持会话和图形。我也没有 .pbtxt 文件。
我的问题:是否可以在 OpenCV C++ 中使用通过 TF2 Object Detection API 训练的模型?
如果您帮助我解决此问题或提供任何有用的建议,我将不胜感激。
我想在自定义数据集上训练 Mobilenet SSD 模型。
我研究了重新训练模型的工作流程,并注意到配置文件中的 image_resizer{} 块:
这里的纵横比是否必须像 300x300 这样的 1:1 或我可以指定自定义比例?
我所有的数据集图像都是 960x256 - 所以我可以输入这个大小的高度和宽度吗?或者我是否需要调整所有图像的大小以使其纵横比为 1:1?
我正在使用fast_rcnn_inception_v2_coco作为预训练模型在 Windows 10 上训练Tensorflow 对象检测。我在 Windows 10 上,在 NVIDIA GeForce GTX 1080、CUDA 9.0 和 CUDNN 7.0 上使用 tensorflow-gpu 1.6。
我的数据集只包含一个对象“手枪”和 3000 张图像(2700 个训练集,300 个测试集)。图像的大小从 ~100x200 到 ~800x600。
我对该模型进行了 55k 次迭代训练,其中mAP约为 0.8,而TotalLoss似乎收敛到 0.001。但是,但是,看到评估,在同一个检测到的对象(例如this和this)上有很多多个边界框,并且有很多误报(房子被检测为手枪)。例如,在我拍摄的这张照片中(后来应用了模糊滤镜),模型将人和汽车检测为手枪,以及正确检测。
数据集与 tfrecords 和标签图一起上传到这里。我使用了这个配置文件,其中我唯一更改的内容是:num_classes为 1、fine_tune_checkpoint、train 和 eval 的input_path和label_map_path以及num_examples。 由于我认为多个框是非最大抑制问题,因此我将score_threshold(第 73 行)从 0 更改为 0.01,将iou_threshold(第 74 行)从 …
object-detection false-positive non-maximum-suppression tensorflow object-detection-api
tensorflow ×8
python ×4
c++ ×1
faster-rcnn ×1
opencv ×1
resnet ×1
tensorboard ×1
tfrecord ×1
yolo ×1