Giter VIP home page Giter VIP logo

Comments (4)

fuersta avatar fuersta commented on May 19, 2024 1

I am also looking into an answer as the dataset looks a bit messy.
By any chance could you provide the script where you cleaned up the title and/or description?

from open_clip.

Lauler avatar Lauler commented on May 19, 2024

@Ascn89 A first suggestion for you would be something like this:

import pandas as pd
import urllib

df["title"] = df["title"].replace(np.nan, "", regex=True)
df["description"] = df["description"].replace(np.nan, "", regex=True)
df["title"] = df["title"].apply(lambda x: str.replace(urllib.parse.unquote(x), "+", " "))
df["description"] = df["description"].apply(
    lambda x: str.replace(urllib.parse.unquote(x), "+", " ")
)

However, the level of cleaning necessary to match the published results is uncertain, and I hope authors of this repo can provide some insights there.

from open_clip.

gabrielilharco avatar gabrielilharco commented on May 19, 2024

Hi @Lauler, in our experiments we used a concatenation of title and description, with a little bit of cleaning. Hope this helps!

Useful functions:

def remove_html(raw_html):
    cleanr = re.compile('<.*?>')
    cleantext = re.sub(cleanr, '', raw_html)
    return cleantext

def clean_text(x):
    return remove_html(ftfy.fix_text(urllib.parse.unquote_plus(x)))

What we use for the text side for each sample:

text = clean_text(table['title'][idx] + ' ' + table['description'][idx])[:500]

from open_clip.

Lauler avatar Lauler commented on May 19, 2024

Thank you that is very helpful!

from open_clip.

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.