Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Jul 26, 2022

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from kerikh July 26, 2022 05:50
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to GitHub API limits, only the first 60 comments can be shown.

Comment on lines 14 to 15

for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction + " : " + eachProbability) No newline at end of file
print(f"{eachPrediction} : {eachProbability}") No newline at end of file
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 15-15 refactored with the following changes:

Comment on lines 12 to 13
predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "1.jpg"), result_count=5 )
for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction + " : " + eachProbability) No newline at end of file
print(f"{eachPrediction} : {eachProbability}") No newline at end of file
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 13-13 refactored with the following changes:

Comment on lines -11 to +23
all_images_array = []

all_files = os.listdir(execution_path)
for each_file in all_files:
if(each_file.endswith(".jpg") or each_file.endswith(".png")):
all_images_array.append(each_file)
all_images_array = [
each_file
for each_file in all_files
if (each_file.endswith(".jpg") or each_file.endswith(".png"))
]

results_array = multiple_prediction.predictMultipleImages(all_images_array, result_count_per_image=5)

for each_result in results_array:
predictions, percentage_probabilities = each_result["predictions"], each_result["percentage_probabilities"]
for index in range(len(predictions)):
print(predictions[index] + " : " + percentage_probabilities[index])
print(f"{predictions[index]} : {percentage_probabilities[index]}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 11-23 refactored with the following changes:

Comment on lines -185 to +187
if(self.__modelLoaded == False):
if (self.__modelLoaded == False):
raise ValueError("You must call the loadModel() function before making object detection.")
elif(self.__modelLoaded == True):
elif self.__modelLoaded == True:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ObjectDetection.detectObjectsFromImage refactored with the following changes:

Comment on lines -392 to +400
elif (self.__modelLoaded == True):
elif self.__modelLoaded == True:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ObjectDetection.detectCustomObjectsFromImage refactored with the following changes:

else:
axis = 1

axis = 3 if keras.backend.image_data_format() == "channels_last" else 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TimeDistributedResNet refactored with the following changes:

Comment on lines -37 to +39
# set bias to -log((1 - p)/p) for foregound
result = np.ones(shape, dtype=dtype) * -math.log((1 - self.probability) / self.probability)

return result
return np.ones(shape, dtype=dtype) * -math.log(
(1 - self.probability) / self.probability
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PriorProbability.__call__ refactored with the following changes:

This removes the following comments ( why? ):

# set bias to -log((1 - p)/p) for foregound

Comment on lines -49 to +51
pred_boxes = keras.backend.stack([pred_boxes_x1, pred_boxes_y1, pred_boxes_x2, pred_boxes_y2], axis=2)

return pred_boxes
return keras.backend.stack(
[pred_boxes_x1, pred_boxes_y1, pred_boxes_x2, pred_boxes_y2], axis=2
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function bbox_transform_inv refactored with the following changes:

from .tensorflow_backend import *
else:
raise ValueError("Unknown backend: " + str(_BACKEND))
raise ValueError(f"Unknown backend: {str(_BACKEND)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 19-19 refactored with the following changes:

Comment on lines -60 to +63
if None not in input_shape[1:]:
total = np.prod(input_shape[1:3]) * self.num_anchors
return (input_shape[0], total, 4)
else:
if None in input_shape[1:]:
return (input_shape[0], None, 4)
total = np.prod(input_shape[1:3]) * self.num_anchors
return (input_shape[0], total, 4)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Anchors.compute_output_shape refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant