Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
93d1f0da
Commit
93d1f0da
authored
May 18, 2022
by
Mark Daoust
Browse files
use properties
parent
ac41d871
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
official/projects/cots_detector/crown_of_thorns_starfish_detection_pipeline.ipynb
...etector/crown_of_thorns_starfish_detection_pipeline.ipynb
+9
-5
No files found.
official/projects/cots_detector/crown_of_thorns_starfish_detection_pipeline.ipynb
View file @
93d1f0da
...
@@ -536,15 +536,19 @@
...
@@ -536,15 +536,19 @@
" d.update(kwargs)\n",
" d.update(kwargs)\n",
" return type(self)(**d)\n",
" return type(self)(**d)\n",
"\n",
"\n",
" @property\n",
" def center(self)-> Tuple[float, float]:\n",
" def center(self)-> Tuple[float, float]:\n",
" return ((self.x0+self.x1)/2, (self.y0+self.y1)/2)\n",
" return ((self.x0+self.x1)/2, (self.y0+self.y1)/2)\n",
" \n",
" \n",
" @property\n",
" def width(self) -> float:\n",
" def width(self) -> float:\n",
" return self.x1 - self.x0\n",
" return self.x1 - self.x0\n",
"\n",
"\n",
" @property\n",
" def height(self) -> float:\n",
" def height(self) -> float:\n",
" return self.y1 - self.y0\n",
" return self.y1 - self.y0\n",
"\n",
"\n",
" @property\n",
" def area(self)-> float:\n",
" def area(self)-> float:\n",
" return (self.x1 - self.x0 + 1) * (self.y1 - self.y0 + 1)\n",
" return (self.x1 - self.x0 + 1) * (self.y1 - self.y0 + 1)\n",
" \n",
" \n",
...
@@ -562,9 +566,9 @@
...
@@ -562,9 +566,9 @@
" if intersection is None:\n",
" if intersection is None:\n",
" return 0\n",
" return 0\n",
" \n",
" \n",
" ia = intersection.area
()
\n",
" ia = intersection.area\n",
"\n",
"\n",
" return ia/(self.area
()
+ other.area
()
- ia)\n",
" return ia/(self.area + other.area - ia)\n",
" \n",
" \n",
" def draw(self, image, label=None, color=(0, 140, 255)):\n",
" def draw(self, image, label=None, color=(0, 140, 255)):\n",
" image = np.asarray(image)\n",
" image = np.asarray(image)\n",
...
@@ -740,9 +744,9 @@
...
@@ -740,9 +744,9 @@
" of_params = default_of_params()\n",
" of_params = default_of_params()\n",
"\n",
"\n",
" bboxes = [det.bbox for det in detections]\n",
" bboxes = [det.bbox for det in detections]\n",
" centers = np.float32([[bbox.center
()
for bbox in bboxes]])\n",
" centers = np.float32([[bbox.center for bbox in bboxes]])\n",
" widths = np.float32([[bbox.width
()
for bbox in bboxes]])\n",
" widths = np.float32([[bbox.width for bbox in bboxes]])\n",
" heights = np.float32([[bbox.height
()
for bbox in bboxes]])\n",
" heights = np.float32([[bbox.height for bbox in bboxes]])\n",
"\n",
"\n",
"\n",
"\n",
" new_centers, status, error = cv2.calcOpticalFlowPyrLK(\n",
" new_centers, status, error = cv2.calcOpticalFlowPyrLK(\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment