-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from GreenTeaProgrammers/feature/machine-lear…
…ning/refactor refactor(ml)
- Loading branch information
Showing
9 changed files
with
69 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
machine_learning/src/face_detect_model/DetectFaceAndClip/detectFaceUtil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import cv2 | ||
import os | ||
|
||
|
||
def load_cascade(cascade_path): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import google.cloud.storage as gcs | ||
from google.cloud.storage import Bucket | ||
import os | ||
|
||
|
||
def init_client(): | ||
# NOTE: gcloud auth application-default loginにて事前に認証 | ||
PROJECT_ID = os.environ.get("PROJECT_ID") | ||
|
||
client = gcs.Client(PROJECT_ID) | ||
if client is None: | ||
raise RuntimeError("Failed to initialize client.") | ||
else: | ||
return client | ||
|
||
|
||
def get_bucket(client: gcs.Client, bucket_name: str): | ||
bucket = client.bucket(bucket_name) | ||
|
||
if bucket.exists(): | ||
return bucket | ||
else: | ||
raise ValueError(f"Failed to {bucket_name} does not exist.") | ||
|
||
|
||
def get_blobs(bucket: Bucket, blob_name: str): | ||
# blobsの中身に対するエラーハンドリング | ||
try: | ||
blobs = list(bucket.list_blobs(prefix=blob_name)) | ||
if len(blobs) == 0: # 最初の要素がない場合、イテレータは空 | ||
raise ValueError(f"No blobs found with prefix '{blob_name}' in the bucket.") | ||
else: | ||
return blobs | ||
except Exception as e: | ||
raise ValueError(f"Failed to get blobs from '{blob_name}' due to an error: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def main(): | ||
gray = cv2.cvtColor(captureBuffer, cv2.COLOR_BGR2GRAY) | ||
pred_child_ids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
return pred_child_ids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters