-
Notifications
You must be signed in to change notification settings - Fork 15
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 #76 from grycap/storage
Update OSCAR to use the new supervisor
- Loading branch information
Showing
7 changed files
with
194 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
echo "SCRIPT: Invoked Image Grayifier. File available in $SCAR_INPUT_FILE" | ||
FILE_NAME=`basename $SCAR_INPUT_FILE` | ||
OUTPUT_FILE=$SCAR_OUTPUT_FOLDER/$FILE_NAME | ||
echo "SCRIPT: Converting input image file $SCAR_INPUT_FILE to grayscale to output file $OUTPUT_FILE" | ||
convert $SCAR_INPUT_FILE -type Grayscale $OUTPUT_FILE | ||
echo "SCRIPT: Invoked Image Grayifier. File available in $INPUT_FILE_PATH" | ||
FILE_NAME=`basename $INPUT_FILE_PATH` | ||
OUTPUT_FILE=$STORAGE_OUTPUT_DIR/$FILE_NAME | ||
echo "SCRIPT: Converting input image file $INPUT_FILE_PATH to grayscale to output file $OUTPUT_FILE" | ||
convert $INPUT_FILE_PATH -type Grayscale $OUTPUT_FILE |
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,10 +1,12 @@ | ||
#!/bin/bash | ||
|
||
FILENAME="`basename $SCAR_INPUT_FILE`" | ||
RESULT="$SCAR_OUTPUT_FOLDER/$FILENAME.out" | ||
OUTPUT_IMAGE="$SCAR_OUTPUT_FOLDER/$FILENAME" | ||
FILENAME="`basename $INPUT_FILE_PATH`" | ||
# Remove extension from filename | ||
FILENAME=${FILENAME%.*} | ||
RESULT="$STORAGE_OUTPUT_DIR/$FILENAME.out" | ||
OUTPUT_IMAGE="$STORAGE_OUTPUT_DIR/$FILENAME" | ||
|
||
echo "SCRIPT: Analyzing file '$SCAR_INPUT_FILE', saving the result in '$RESULT' and the output image in '$OUTPUT_IMAGE.png'" | ||
echo "SCRIPT: Analyzing file '$INPUT_FILE_PATH', saving the result in '$RESULT' and the output image in '$OUTPUT_IMAGE'" | ||
|
||
cd /opt/darknet | ||
./darknet detect cfg/yolov3.cfg yolov3.weights $SCAR_INPUT_FILE -out $OUTPUT_IMAGE > $RESULT | ||
./darknet detect cfg/yolov3.cfg yolov3.weights $INPUT_FILE_PATH -out $OUTPUT_IMAGE > $RESULT |
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,67 @@ | ||
# Copyright (C) GRyCAP - I3M - UPV | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import json | ||
import logging | ||
import os | ||
|
||
loglevel = logging.INFO | ||
if "LOG_LEVEL" in os.environ: | ||
loglevel = os.environ["LOG_LEVEL"] | ||
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
logging.basicConfig(level=loglevel, format=FORMAT) | ||
logger = logging.getLogger('oscar') | ||
|
||
def debug(cli_msg, log_msg=None): | ||
if loglevel == logging.DEBUG: | ||
print(cli_msg) | ||
logger.debug(log_msg) if log_msg else logger.debug(cli_msg) | ||
|
||
def info(cli_msg=None, log_msg=None): | ||
if cli_msg and loglevel == logging.INFO: | ||
print(cli_msg) | ||
logger.info(log_msg) if log_msg else logger.info(cli_msg) | ||
|
||
def warning(cli_msg, log_msg=None): | ||
print(cli_msg) | ||
logger.warning(log_msg) if log_msg else logger.warning(cli_msg) | ||
|
||
def error(cli_msg, log_msg=None): | ||
if log_msg: | ||
print(log_msg) | ||
logger.error(log_msg) | ||
else: | ||
print(cli_msg) | ||
logger.error(cli_msg) | ||
|
||
def exception(msg): | ||
logger.exception(msg) | ||
|
||
def log_exception(error_msg, exception): | ||
error(error_msg, error_msg + ": {0}".format(exception)) | ||
|
||
def print_json(value): | ||
print(json.dumps(value)) | ||
|
||
def info_json(cli_msg, log_msg=None): | ||
print_json(cli_msg) | ||
logger.info(log_msg) if log_msg else logger.info(cli_msg) | ||
|
||
def warning_json(cli_msg, log_msg=None): | ||
print_json(cli_msg) | ||
logger.warning(log_msg) if log_msg else logger.warning(cli_msg) | ||
|
||
def error_json(cli_msg, log_msg=None): | ||
print_json(cli_msg) | ||
logger.error(log_msg) if log_msg else logger.error(cli_msg) |
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
Oops, something went wrong.