Coder Social home page Coder Social logo

Comments (9)

yylstudy avatar yylstudy commented on June 3, 2024 1

@shiyu22 非常感谢,解决了我的问题,去除async后,现在qps从原先的1到达30+了,基于此issue我提交了一个pr,不好意思我之前还未提交过pr,麻烦你看下是否符合规范,再次感谢您!

from bootcamp.

shiyu22 avatar shiyu22 commented on June 3, 2024

Hi @yylstudy, you can try to update the Resnet50 in encode.py with the following code:

Note that you need to install towhee with pip install towhee==1.0.0rc1. And will release 1.0.0 later.

from towhee import pipe, ops


class Resnet50:
    def __init__(self):
        self.image_embedding_pipe = (
            pipe.input('path')
                .map('path', 'img', ops.image_decode.cv2_rgb())
                .map('img', 'embedding', ops.image_embedding.timm(model_name='resnet50'))
                .map('embedding', 'embedding', ops.towhee.np_normalize())
                .output('embedding')
            )

    def resnet50_extract_feat(self, img_path):
        feat = self.image_embedding_pipe(img_path)
        return feat.get()[0]

The new towhee code will just load the pipeline just one time.

from bootcamp.

yylstudy avatar yylstudy commented on June 3, 2024

@shiyu22 你好,麻烦再请问下,性能现在是没问题了,但是用上面代码测试后发现distance会变得非常大,之前都是
0.1~1.x之间,这个是为什么呢,谢谢
image

from bootcamp.

yylstudy avatar yylstudy commented on June 3, 2024

现在milvus版本为v2.0.2,distance的值大小是否与milvus版本有关系

from bootcamp.

shiyu22 avatar shiyu22 commented on June 3, 2024

现在milvus版本为v2.0.2,distance的值大小是否与milvus版本有关系

No, it's because there is no normalization of the vector. I will add np_normalize() for it.

from bootcamp.

shiyu22 avatar shiyu22 commented on June 3, 2024

Hi @yylstudy, you can try to update the Resnet50 in encode.py with the following code:

Note that you need to install towhee with pip install towhee==1.0.0rc1. And will release 1.0.0 later.

from towhee import pipe, ops


class Resnet50:
    def __init__(self):
        self.image_embedding_pipe = (
            pipe.input('path')
                .map('path', 'img', ops.image_decode.cv2_rgb())
                .map('img', 'embedding', ops.image_embedding.timm(model_name='resnet50'))
                .map('embedding', 'embedding', ops.towhee.np_normalize())
                .output('embedding')
            )

    def resnet50_extract_feat(self, img_path):
        feat = self.image_embedding_pipe(img_path)
        return feat.get()[0]

The new towhee code will just load the pipeline just one time.

@yylstudy can you try it again?

And if it fixed your issue, can you submit a PR to modify the encode.py and be our contributor?

from bootcamp.

shiyu22 avatar shiyu22 commented on June 3, 2024

It's my pleasure:) And thanks for your contribution.

from bootcamp.

DAAworld avatar DAAworld commented on June 3, 2024

你这个图搜图的效果怎么样?我在用这个的时候发现把已经导入进去的图截取一部分进行搜索,搜不出来之前完整的图片。

from bootcamp.

codingjaguar avatar codingjaguar commented on June 3, 2024

cropping image may cause significant change of the semantic. so it's not surprising to not return the original full picture.

from bootcamp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.