-
Notifications
You must be signed in to change notification settings - Fork 4
SAM2 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
SAM2 #155
Conversation
| float scale = GetScale(originalWidth, originalHeight); | ||
| int newWidth = imageSize; | ||
| int newHeight = imageSize; | ||
| Color32[] resizedImage = ResizeColor32( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ResizeColor32, scaling is performed without maintaining the aspect ratio, ignoring scale. In ApplyCoordinateScaling, the coordinates of the Point are corrected with scale. A mismatch occurs here. Please provide the scale as an argument to ResizeColor32 and perform resizing while maintaining the aspect ratio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. The solution is to scale the width and height separately with target size(1024). Because the inference need the shape to be (3, 1024, 1024). So if scale ratio(GetScale) cause it become (3, 683, 1024),it will cause memory out error with the inference.
Please refer to line 1279.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@larryaxinc Resize while maintaining the aspect ratio, and fill the margins with black. If this is not corrected, I think the problem where the clicked point and the segmented point do not align will not be resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Application.temporaryCachePath, | ||
| promptProtoPath | ||
| ); | ||
| // string mlpPath = System.IO.Path.Combine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete unnecessary comments.
|
@larryaxinc I have filled in the feedback, so please respond. Also, please test whether it works in WEB camera mode. You can set camera_mode to true in AiliaImageSegmentationSample.cs to enable WEB camera mode. |
|
@larryaxinc The accuracy is lower compared to the Python version. Please dump the input and output float values of the vision encoder and calculate the mean squared error between the outputs of the Python and Unity versions to analyze where the issue lies.
|
@kyakuno It has been fixed by the new commit. Please have a check. |





#145 Implemented.
Also looks like the click point on image height is not fit well. It would be very appreciate if you could have some idea.