-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[incremental learning] example:keep all results whether is hardExample or not, fixed the issue of using s3 to save model #107
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
import os | ||
import six | ||
import logging | ||
from urllib.parse import urlparse | ||
|
||
import cv2 | ||
import numpy as np | ||
|
@@ -26,8 +27,21 @@ | |
from yolo3_multiscale import Yolo3 | ||
from yolo3_multiscale import YoloConfig | ||
|
||
|
||
os.environ['BACKEND_TYPE'] = 'TENSORFLOW' | ||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' | ||
s3_url = os.getenv("S3_ENDPOINT_URL", "http://s3.amazonaws.com") | ||
if not (s3_url.startswith("http://") or s3_url.startswith("https://")): | ||
_url = f"https://{s3_url}" | ||
s3_url = urlparse(s3_url) | ||
s3_use_ssl = s3_url.scheme == 'https' if s3_url.scheme else True | ||
|
||
os.environ["AWS_ACCESS_KEY_ID"] = os.getenv("ACCESS_KEY_ID", "") | ||
os.environ["AWS_SECRET_ACCESS_KEY"] = os.getenv("SECRET_ACCESS_KEY", "") | ||
os.environ["S3_ENDPOINT"] = s3_url.netloc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if not env ACCESS_KEY_ID, os.getenv("ACCESS_KEY_ID") will be None, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
os.environ["S3_USE_HTTPS"] = "1" if s3_use_ssl else "0" | ||
LOG = logging.getLogger(__name__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. constant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do developers need to know constants in lib? |
||
flags = tf.flags.FLAGS | ||
|
||
|
||
def preprocess(image, input_shape): | ||
|
@@ -89,7 +103,7 @@ def train(self, train_data, valid_data=None, **kwargs): | |
|
||
data_gen = DataGen(yolo_config, train_data.x) | ||
|
||
max_epochs = int(kwargs.get("max_epochs", "1")) | ||
max_epochs = int(kwargs.get("epochs", flags.max_epochs)) | ||
config = tf.ConfigProto(allow_soft_placement=True) | ||
config.gpu_options.allow_growth = True | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does a developer find the env 'HEM_NAME'? If this is a sedna system environment varibles, it should provide a function or class for the developer, instead of expose an environment name which the developer might find only in documents.
In sedna, there are two seperated parameter entries for deployer and developer, and the parameter should be subject to CRD or LIB.
for example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix