Skip to content

Commit

Permalink
bugfix: Object detection pipeline percentage and threshold not working
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithKyrian committed Apr 10, 2024
1 parent d0b1f0d commit 4126524
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Pipelines/ObjectDetectionPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Codewithkyrian\Transformers\Pipelines;

use Codewithkyrian\Transformers\Models\Output\ObjectDetectionOutput;
use Exception;
use function Codewithkyrian\Transformers\Utils\getBoundingBox;
use function Codewithkyrian\Transformers\Utils\prepareImages;

Expand All @@ -30,14 +31,14 @@ class ObjectDetectionPipeline extends Pipeline

public function __invoke(array|string $inputs, ...$args): array
{
$threshold = $options['threshold'] ?? 0.9;
$percentage = $options['percentage'] ?? false;
$threshold = $args['threshold'] ?? 0.9;
$percentage = $args['percentage'] ?? false;


$isBatched = is_array($inputs);

if ($isBatched && count($inputs) !== 1) {
throw new \Exception("Object detection pipeline currently only supports a batch size of 1.");
throw new Exception("Object detection pipeline currently only supports a batch size of 1.");
}

$preparedImages = prepareImages($inputs);
Expand Down

0 comments on commit 4126524

Please sign in to comment.