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 4e196d7..219c131 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 8d25954..c7e80c9 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 db95cc1..bb19b41 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 6392231..75d42d6 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 f951642..bb881d3 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;
   }