passing too many args to tool binaries is an error
authorJonathan L Long <jonlong@cs.berkeley.edu>
Thu, 27 Mar 2014 22:11:17 +0000 (15:11 -0700)
committerJonathan L Long <jonlong@cs.berkeley.edu>
Thu, 27 Mar 2014 22:17:51 +0000 (15:17 -0700)
tools/convert_imageset.cpp
tools/finetune_net.cpp
tools/net_speed_benchmark.cpp
tools/test_net.cpp
tools/train_net.cpp

index 4e196d7004f118033cfe97da241f674e4d7a156e..219c13104ccc255a32247e7000a57ba8a60f43c9 100644 (file)
@@ -30,7 +30,7 @@ using std::string;
 
 int main(int argc, char** argv) {
   ::google::InitGoogleLogging(argv[0]);
-  if (argc < 4) {
+  if (argc < 4 || argc > 5) {
     printf("Convert a set of images to the leveldb format used\n"
         "as input for Caffe.\n"
         "Usage:\n"
index 8d25954f1cd3b724e4729dceab03da0e733fc2ce..c7e80c94220fc9b6385366bb62d4ffd9f45c41c6 100644 (file)
@@ -14,7 +14,7 @@ using namespace caffe;  // NOLINT(build/namespaces)
 
 int main(int argc, char** argv) {
   ::google::InitGoogleLogging(argv[0]);
-  if (argc < 2) {
+  if (argc != 3) {
     LOG(ERROR) << "Usage: finetune_net solver_proto_file pretrained_net";
     return 0;
   }
index db95cc17aeb1c6e2d3843d1646f89e6711c29ea6..bb19b41b092090eee5acfce56265cce970ff33d6 100644 (file)
@@ -22,7 +22,7 @@ using namespace caffe;  // NOLINT(build/namespaces)
 
 int main(int argc, char** argv) {
   int total_iter = 50;
-  if (argc < 2) {
+  if (argc < 2 || argc > 5) {
     LOG(ERROR) << "net_speed_benchmark net_proto [iterations=50]"
         " [CPU/GPU] [Device_id=0]";
     return 0;
index 639223144409b9ff2254b7f013a9d07f97cdbf3d..75d42d666e9c48c652057f29c434d011e9ecbf89 100644 (file)
@@ -17,7 +17,7 @@
 using namespace caffe;  // NOLINT(build/namespaces)
 
 int main(int argc, char** argv) {
-  if (argc < 4) {
+  if (argc < 4 || argc > 5) {
     LOG(ERROR) << "test_net net_proto pretrained_net_proto iterations "
         << "[CPU/GPU]";
     return 0;
index f9516421fbc5bdc96013fc841ae9f632f44ba5b6..bb881d3e8952b8674f21d8ec5ec21760a52fa279 100644 (file)
@@ -15,7 +15,7 @@ using namespace caffe;  // NOLINT(build/namespaces)
 
 int main(int argc, char** argv) {
   ::google::InitGoogleLogging(argv[0]);
-  if (argc < 2) {
+  if (argc < 2 || argc > 3) {
     LOG(ERROR) << "Usage: train_net solver_proto_file [resume_point_file]";
     return 0;
   }