Skip to content

Commit

Permalink
Faster inference
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed May 12, 2024
1 parent a9c4ecd commit 641e850
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions source/ai.d
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,19 @@ struct AI
assert(hasAI);

import mir.algorithm.iteration : minIndex, maxIndex;
import picture : Picture;

assert(session !is null);

Image img = imread(file);
scope(exit) destroyFree(img);
Image img = new Image(
Picture.width,
Picture.height,
ImageFormat.IF_RGB,
BitDepth.BD_8,
cast(ubyte[])Picture.pixbuf.getPixelsWithLength()
);

scope(exit) destroy(img);

Slice!(ubyte*, 3) imSlice = img.sliced; // will be freed with the previous destroyFree(img)

Expand Down
2 changes: 1 addition & 1 deletion source/gui.d
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ struct GUI
auto airects = AI.boxes(Picture.current);
Picture.rects ~= airects;
Picture.historyCommit();
confirmAnnotation();
Picture.writeAnnotations();
canvas.queueDraw();
}

Expand Down

0 comments on commit 641e850

Please sign in to comment.