Skip to content
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

Bulk Insert #2

Closed
Kencho5 opened this issue Dec 27, 2021 · 5 comments
Closed

Bulk Insert #2

Kencho5 opened this issue Dec 27, 2021 · 5 comments

Comments

@Kencho5
Copy link

Kencho5 commented Dec 27, 2021

Hello,

i noticed that there is no function to bulk insert images. i tried making my own and succeeded, but i noticed that making the signature data using MakeSignatureData() function is pretty slow compared to python's image-match module. it took 0.4 seconds on average to generate signature data in python and it takes 1.2 seconds in ImageMatchNet. what could be the case here?

thanks.

@ravenyue
Copy link
Owner

Hello @Kencho5
I did benchmarking and the insertion didn't take very long. Can you explain your specific scenario and how to reproduce it?

Benchmarking source code: ImageMatchNetBenchmark.zip

image

@Kencho5
Copy link
Author

Kencho5 commented Dec 27, 2021

i noticed that i was calling the same function in a loop which was slowing down things. does ImageMatchNet have bulk insert or i have to implement that myself? sorry for the trouble

@ravenyue
Copy link
Owner

@Kencho5 Currently there is no bulk insert method. I use the following code for bulk insertion and it doesn't take long
I don't know how you do it, can you provide your code?

var path = Path.Combine(Directory.GetCurrentDirectory(), "images/1.jpg");
var storage = new ElasticsearchSignatureStorage("http://localhost:9200");
var sw = new Stopwatch();
for (int i = 0; i < 1000; i++)
{
    var key = Path.GetRandomFileName();
    sw.Start();
    storage.AddOrUpdateImage(key, path);
    sw.Stop();
    Console.WriteLine($"Inserted Key:'{key}', Elapsed:{sw.ElapsedMilliseconds}ms");
    sw.Restart();
}

image

@Kencho5
Copy link
Author

Kencho5 commented Dec 28, 2021

i needed to insert images from urls so i had to make an async function which takes urls, gets image bytes from around 5,000 images, created signature data using your functions from ImageMatchNet, appends those signature data objects to list and bulk inserts into elastic. takes around 4-5 seconds. i can share code if you need it

@ravenyue
Copy link
Owner

Please provide the code that can reproduce the issue

@Kencho5 Kencho5 closed this as completed Dec 30, 2021
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

No branches or pull requests

2 participants