SavyaSanchi-Sharma commited on
Commit
623dcd2
·
1 Parent(s): 6a6a0b2

ssd_mobilenet_v1_coco_2017_11_17

Browse files
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/LICENSE RENAMED
@@ -1,13 +1,4 @@
1
- Copyright 2022 Google LLC. All rights reserved.
2
-
3
- All files in the following folders:
4
- /community
5
- /official
6
- /orbit
7
- /research
8
- /tensorflow_models
9
-
10
- Are licensed as follows:
11
 
12
  Apache License
13
  Version 2.0, January 2004
@@ -197,7 +188,7 @@ Are licensed as follows:
197
  same "printed page" as the copyright notice for easier
198
  identification within third-party archives.
199
 
200
- Copyright 2016, The Authors.
201
 
202
  Licensed under the Apache License, Version 2.0 (the "License");
203
  you may not use this file except in compliance with the License.
 
1
+ Copyright 2015 The TensorFlow Authors. All rights reserved.
 
 
 
 
 
 
 
 
 
2
 
3
  Apache License
4
  Version 2.0, January 2004
 
188
  same "printed page" as the copyright notice for easier
189
  identification within third-party archives.
190
 
191
+ Copyright 2015, The TensorFlow Authors.
192
 
193
  Licensed under the Apache License, Version 2.0 (the "License");
194
  you may not use this file except in compliance with the License.
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/README.md RENAMED
@@ -1,21 +1,21 @@
1
- # SSD MobileNet v2 COCO
2
 
3
- Object detection with a Single Shot MultiBox Detector (SSD) built on a MobileNet v2 backbone,
4
  trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow graph
5
- (`ssd_mobilenet_v2_coco_2018_03_29.pb`) and converted to ONNX for use with OpenCV's DNN module.
6
 
7
  ## Model Details
8
- - **Architecture**: SSD (Single Shot MultiBox Detector) with MobileNet v2 backbone
9
  - **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
10
  - **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
11
  - **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
12
- - **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz
13
 
14
  ## Usage
15
 
16
  ### Python
17
  ```bash
18
- python demo.py --model ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
19
  ```
20
 
21
  ### C++
@@ -35,7 +35,7 @@ g++ -std=c++17 demo.cpp -o demo \
35
  -I$OCVBUILD \
36
  -L$ORT/lib -Wl,-rpath,$ORT/lib -lonnxruntime \
37
  -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
38
- ./demo --model ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
39
  ```
40
 
41
  ## Conversion
@@ -45,7 +45,7 @@ via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outpu
45
  Requires `tensorflow`, `tf2onnx`, and `onnx`.
46
 
47
  ```bash
48
- python convert_to_onnx.py --pb ../pb/ssd_mobilenet_v2_coco_2018_03_29.pb
49
  ```
50
 
51
  ## License
 
1
+ # SSD MobileNet v1 COCO
2
 
3
+ Object detection with a Single Shot MultiBox Detector (SSD) built on a MobileNet v1 backbone,
4
  trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow graph
5
+ (`ssd_mobilenet_v1_coco_2017_11_17.pb`) and converted to ONNX for use with OpenCV's DNN module.
6
 
7
  ## Model Details
8
+ - **Architecture**: SSD (Single Shot MultiBox Detector) with MobileNet v1 backbone
9
  - **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
10
  - **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
11
  - **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
12
+ - **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2017_11_17.tar.gz
13
 
14
  ## Usage
15
 
16
  ### Python
17
  ```bash
18
+ python demo.py --model ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
19
  ```
20
 
21
  ### C++
 
35
  -I$OCVBUILD \
36
  -L$ORT/lib -Wl,-rpath,$ORT/lib -lonnxruntime \
37
  -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
38
+ ./demo --model ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
39
  ```
40
 
41
  ## Conversion
 
45
  Requires `tensorflow`, `tf2onnx`, and `onnx`.
46
 
47
  ```bash
48
+ python convert_to_onnx.py --pb ../pb/ssd_mobilenet_v1_coco_2017_11_17.pb
49
  ```
50
 
51
  ## License
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/convert_to_onnx.py RENAMED
@@ -14,8 +14,8 @@ def load_graph_def(pb_path):
14
 
15
 
16
  def main():
17
- parser = argparse.ArgumentParser(description="Export ssd_mobilenet_v2_coco_2018_03_29.pb to ONNX")
18
- parser.add_argument("--pb", default="../pb/ssd_mobilenet_v2_coco_2018_03_29.pb")
19
  parser.add_argument("--opset", type=int, default=18)
20
  args = parser.parse_args()
21
 
@@ -30,7 +30,7 @@ def main():
30
  onnx.checker.check_model(model_proto)
31
 
32
  stamp = datetime.datetime.now().strftime("%Y%b").lower()
33
- onnx_path = "ssd_mobilenet_v2_coco_2018_03_29_%s.onnx" % stamp
34
  with open(onnx_path, "wb") as f:
35
  f.write(model_proto.SerializeToString())
36
  print("wrote", onnx_path)
 
14
 
15
 
16
  def main():
17
+ parser = argparse.ArgumentParser(description="Export ssd_mobilenet_v1_coco_2017_11_17.pb to ONNX")
18
+ parser.add_argument("--pb", default="../pb/ssd_mobilenet_v1_coco_2017_11_17.pb")
19
  parser.add_argument("--opset", type=int, default=18)
20
  args = parser.parse_args()
21
 
 
30
  onnx.checker.check_model(model_proto)
31
 
32
  stamp = datetime.datetime.now().strftime("%Y%b").lower()
33
+ onnx_path = "ssd_mobilenet_v1_coco_2017_11_17_%s.onnx" % stamp
34
  with open(onnx_path, "wb") as f:
35
  f.write(model_proto.SerializeToString())
36
  print("wrote", onnx_path)
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/demo.cpp RENAMED
@@ -18,7 +18,7 @@ static std::string argVal(int argc, char** argv, const std::string& key, const s
18
 
19
  int main(int argc, char** argv)
20
  {
21
- std::string model = argVal(argc, argv, "--model", "ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx");
22
  std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
23
  std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
24
  float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
@@ -92,7 +92,7 @@ int main(int argc, char** argv)
92
  }
93
 
94
  imwrite(output, out);
95
- std::cout << "ssd_mobilenet_v2_coco_2018_03_29 " << lines.size() << " detections" << std::endl;
96
  for (const auto& l : lines) std::cout << l << std::endl;
97
  return 0;
98
  }
 
18
 
19
  int main(int argc, char** argv)
20
  {
21
+ std::string model = argVal(argc, argv, "--model", "ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx");
22
  std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
23
  std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
24
  float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
 
92
  }
93
 
94
  imwrite(output, out);
95
+ std::cout << "ssd_mobilenet_v1_coco_2017_11_17 " << lines.size() << " detections" << std::endl;
96
  for (const auto& l : lines) std::cout << l << std::endl;
97
  return 0;
98
  }
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/demo.py RENAMED
@@ -10,7 +10,7 @@ here = os.path.dirname(os.path.abspath(__file__))
10
 
11
 
12
  def main():
13
- parser = argparse.ArgumentParser(description="SSD MobileNet v2 COCO (ONNX) object detection demo")
14
  parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
15
  parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
16
  parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
@@ -43,7 +43,7 @@ def main():
43
  cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
44
 
45
  cv.imwrite(args.output, out)
46
- print("ssd_mobilenet_v2_coco_2018_03_29", len(kept), "detections")
47
  for c, s, xmin, ymin, xmax, ymax in kept:
48
  print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
49
 
 
10
 
11
 
12
  def main():
13
+ parser = argparse.ArgumentParser(description="SSD MobileNet v1 COCO (ONNX) object detection demo")
14
  parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
15
  parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
16
  parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
 
43
  cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
44
 
45
  cv.imwrite(args.output, out)
46
+ print("ssd_mobilenet_v1_coco_2017_11_17", len(kept), "detections")
47
  for c, s, xmin, ymin, xmax, ymax in kept:
48
  print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
49
 
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/example_outputs/input_image.png RENAMED
File without changes
{ssd_mobilenet_v2_coco_2018_03_29 → ssd_mobilenet_v1_coco_2017_11_17}/example_outputs/output_image.png RENAMED
File without changes
ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx → ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7ba2fdaa87b8cbbb52c16b5c6e31a7452c00e8ad68aec580bfb7b07f5b212619
3
- size 69584537
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7423295086c7ceaca3ccc0059c16989456a08c3e4b8c05e2cc415240f9148e65
3
+ size 29289721