Search_images_bing vs search_images_ddg

I’m working on Bear Classification (as shown in chapter 2), but instead using search_images_bing , I’m using search_images_ddg (I think I saw them doing in Video). After training for cleaning data, I plotted a confusion matrix and the results were surprisingly really bad. Has anyone using search_images_ddg found similar results? When I do a web search using ddg, the results are not bad. But I guess API results are not good enough?

bear_types = "grizly", "black", "teddy"
path = Path("bears")

# create a directory named bears. exist_ok=False; means don't raise exception if 
# directory already exists
path.mkdir(exist_ok=True)

for bear_type in bear_types:
  dest = path/bear_type
  dest.mkdir(exist_ok=True)
  images = search_images_ddg(f"{bear_types} bear")
  download_images(dest, urls=images)

bears = bears.new(
    item_tfms=RandomResizedCrop(224, min_scale=0.5),
    batch_tfms=aug_transforms())
dls = bears.dataloaders(path)

learn = vision_learner(dls, resnet18, metrics=error_rate)
learn.fine_tune(4)

Hello!
I was able to get 3% error rate with 2 epochs while getting images from ddg. Maybe you should try to restart the notebook and run again. Here’s the notebook I ran, it’s clean version of fastbook chapter 2: Google Colab. Try to run it, Let me know if you encounter something else.

strange, I ran yours and the error was 3% and when I ran mine(I did restart and run all) it was 75%
I am going to compare line by line now. Also, how are you running your colab notebook? Seems like I used all my free GPU credits on google colab

Although you likely already figured this out, I wanted to point out that you were searching “f{bear_types} bear”, instead of bear_type. So, you fired off 3 ddg searches for “grizzly”, “black”, “teddy” instead of the 3 distinct types we intended.

2 Likes

He also misspelled ‘grizzly’ with one ‘z’.