使用 cifar10 求解器训练 CNN
Training CNN using cifar10 solver
我正在尝试使用 cifar10 网络层用我自己的数据训练 CNN。
但是,当我 运行 这个命令时:
roishik@roishik-System-Product-Name:~/Desktop/caffe/caffe$ /home/roishik/Desktop/caffe/caffe/build/tools/caffe train --solver /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt 2>&1 | tee /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
我收到此错误消息:
I0726 22:01:40.884320 6596 caffe.cpp:210] Use CPU.
I0726 22:01:40.884771 6596 solver.cpp:48] Initializing solver from parameters:
test_iter: 100
test_interval: 500
base_lr: 0.001
display: 100
max_iter: 4000
lr_policy: "fixed"
momentum: 0.9
weight_decay: 0.004
snapshot: 4000
snapshot_prefix: "/home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar_10_fast"
solver_mode: CPU
net: "/home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt"
train_state {
level: 0
stage: ""
}
snapshot_format: HDF5
I0726 22:01:40.885051 6596 solver.cpp:91] Creating training net from net file: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 1:7: Message type "caffe.NetParameter" has no field named "I0726".
F0726 22:01:40.885253 6596 upgrade_proto.cpp:79] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
*** Check failure stack trace: ***
@ 0x7f0f10ad5daa (unknown)
@ 0x7f0f10ad5ce4 (unknown)
@ 0x7f0f10ad56e6 (unknown)
@ 0x7f0f10ad8687 (unknown)
@ 0x7f0f10f614be caffe::ReadNetParamsFromTextFileOrDie()
@ 0x7f0f10fc6acb caffe::Solver<>::InitTrainNet()
@ 0x7f0f10fc7b9c caffe::Solver<>::Init()
@ 0x7f0f10fc7eca caffe::Solver<>::Solver()
@ 0x7f0f10fa2473 caffe::Creator_SGDSolver<>()
@ 0x40eb6e caffe::SolverRegistry<>::CreateSolver()
@ 0x407d4b train()
@ 0x40589c main
@ 0x7f0f0fae1f45 (unknown)
@ 0x40610b (unknown)
@ (nil) (unknown)
我搜索了整个 google 但没有找到答案。
这行是什么意思?:
Error parsing text-format caffe.NetParameter: 1:7: Message type "caffe.NetParameter" has no field named "I0726".
非常感谢您的帮助!
是你做错了
您正在使用的文件:
Solver: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt
Net: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
Log output: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
需要注意的是,Net文件和日志文件是一样的,也就是说你是用日志数据替换了Net文件。因此,当 caffe 求解器读取 Net 文件时,数据被日志替换,因此出现错误。
这应该可以解决您的问题:
roishik@roishik-System-Product-Name:~/Desktop/caffe/caffe$ /home/roishik/Desktop/caffe/caffe/build/tools/caffe train --solver /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt 2>&1 | tee ./log.txt
但请确保您已将覆盖的 Net
文件替换为正确的文件。
我正在尝试使用 cifar10 网络层用我自己的数据训练 CNN。 但是,当我 运行 这个命令时:
roishik@roishik-System-Product-Name:~/Desktop/caffe/caffe$ /home/roishik/Desktop/caffe/caffe/build/tools/caffe train --solver /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt 2>&1 | tee /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
我收到此错误消息:
I0726 22:01:40.884320 6596 caffe.cpp:210] Use CPU.
I0726 22:01:40.884771 6596 solver.cpp:48] Initializing solver from parameters:
test_iter: 100
test_interval: 500
base_lr: 0.001
display: 100
max_iter: 4000
lr_policy: "fixed"
momentum: 0.9
weight_decay: 0.004
snapshot: 4000
snapshot_prefix: "/home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar_10_fast"
solver_mode: CPU
net: "/home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt"
train_state {
level: 0
stage: ""
}
snapshot_format: HDF5
I0726 22:01:40.885051 6596 solver.cpp:91] Creating training net from net file: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 1:7: Message type "caffe.NetParameter" has no field named "I0726".
F0726 22:01:40.885253 6596 upgrade_proto.cpp:79] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
*** Check failure stack trace: ***
@ 0x7f0f10ad5daa (unknown)
@ 0x7f0f10ad5ce4 (unknown)
@ 0x7f0f10ad56e6 (unknown)
@ 0x7f0f10ad8687 (unknown)
@ 0x7f0f10f614be caffe::ReadNetParamsFromTextFileOrDie()
@ 0x7f0f10fc6acb caffe::Solver<>::InitTrainNet()
@ 0x7f0f10fc7b9c caffe::Solver<>::Init()
@ 0x7f0f10fc7eca caffe::Solver<>::Solver()
@ 0x7f0f10fa2473 caffe::Creator_SGDSolver<>()
@ 0x40eb6e caffe::SolverRegistry<>::CreateSolver()
@ 0x407d4b train()
@ 0x40589c main
@ 0x7f0f0fae1f45 (unknown)
@ 0x40610b (unknown)
@ (nil) (unknown)
我搜索了整个 google 但没有找到答案。 这行是什么意思?:
Error parsing text-format caffe.NetParameter: 1:7: Message type "caffe.NetParameter" has no field named "I0726".
非常感谢您的帮助!
是你做错了
您正在使用的文件:
Solver: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt
Net: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
Log output: /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_train_test.prototxt
需要注意的是,Net文件和日志文件是一样的,也就是说你是用日志数据替换了Net文件。因此,当 caffe 求解器读取 Net 文件时,数据被日志替换,因此出现错误。
这应该可以解决您的问题:
roishik@roishik-System-Product-Name:~/Desktop/caffe/caffe$ /home/roishik/Desktop/caffe/caffe/build/tools/caffe train --solver /home/roishik/Desktop/Thesis/Code/cafe_cnn/first/caffe_models/cifar_10_fast/cifar10_quick_solver.prototxt 2>&1 | tee ./log.txt
但请确保您已将覆盖的 Net
文件替换为正确的文件。