-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -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 | ||
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 | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if not env ACCESS_KEY_ID, os.getenv("ACCESS_KEY_ID") will be None,
os.environ["AWS_ACCESS_KEY_ID"] = None will report error
suggest os.environ.setdefault()
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.
os.getenv() method in Python returns the value of the environment variable key if it exists otherwise returns the default value. os.getenv(key, default = None)