Skip to content

Commit

Permalink
Tune scale size
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Oct 31, 2023
1 parent efc93fa commit f9e6a97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/models/ObjectDetection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function Interact({ settings: { model }, runPipe }: InteractProps): JSX.E
setWIP(true);
try {
setInput(input);
const data = await getImageData(input);
const data = await getImageData(input, 128);
const predicts = await runPipe('object-detection', model, createRawImage(data));
setResults(predicts);
} catch {}
Expand Down
4 changes: 1 addition & 3 deletions utils/image.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { RawImage } from '@xenova/transformers/src/utils/image';

const maxSize = 768;

export async function getImageData(uri: string): global.Image {
export async function getImageData(uri: string, maxSize: number = 512): global.Image {
return await new Promise((resolve, reject) => {
const image = new Image();
image.onload = () => {
Expand Down

0 comments on commit f9e6a97

Please sign in to comment.