Coder Social home page Coder Social logo

got a strange mAP about pytorch_yolov3 HOT 6 CLOSED

dena avatar dena commented on September 17, 2024
got a strange mAP

from pytorch_yolov3.

Comments (6)

hirotomusiker avatar hirotomusiker commented on September 17, 2024 3

Thank you!
The aP calculation you have observed is not an error.
yolov3.weight is trained on the same coco dataset (by the author) but uses the different train/val split.

darknet

train : trainvalno5k
val : 5k
that can be obtained from:
https://github.com/pjreddie/darknet/blob/master/scripts/get_coco_dataset.sh#L22-L23

Ours

train : train2017
val : val2017
that can be obtained from:
http://cocodataset.org/#download

Because there is overlap between trainvalno5k and val2017, the aP calculation result using yolov3.weight on val2017 is higher than the reported one.

from pytorch_yolov3.

deeppower avatar deeppower commented on September 17, 2024 1

@hirotomusiker
Thanks a lot!
Using yolov3.weight on 5k, the mAP[IOU=0.5] is 0.547.

from pytorch_yolov3.

AsiamGit avatar AsiamGit commented on September 17, 2024

thanks a lot~

from pytorch_yolov3.

deeppower avatar deeppower commented on September 17, 2024

@TakashiNinjouji Hi! Do you know where can i find the json file of 5k.txt?

from pytorch_yolov3.

hirotomusiker avatar hirotomusiker commented on September 17, 2024

Hi,
you have to convert 5k.txt to json format.
datadir is the path of the directory where you have 5k.txt, instances_train2017.json and instances_val2017.json.

  1. Load image ids from 5k.txt
import json
with open(datadir + "5k.txt", "r") as f:
    txt_5k = f.read()
txt_5k = txt_5k.split('\n')

ids_5k = [int(w.split('_')[-1].split('.')[0]) for w in txt_5k[:-1]]
  1. extract annotations and image information from train2017 and val2017
train = json.load(open(datadir + "/instances_train2017.json"))
val = json.load(open(datadir + "/instances_val2017.json"))
images_ids = []
annot_ids = []

for an in train['annotations']:
    if an['image_id'] in ids_5k:
        annot_ids.append(an)
        
for im in train['images']:
    if im['id'] in ids_5k:
        images_ids.append(im)

for an in val['annotations']:
    if an['image_id'] in ids_5k:
        annot_ids.append(an)
        
for im in val['images']:
    if im['id'] in ids_5k:
        images_ids.append(im)

  1. save val5k file
val['images'] = images_ids
val['annotations'] = annot_ids

json.dump(val, open(datadir + "/instances_val5k.json", "w"))

Hope it will work for you 😃

from pytorch_yolov3.

hirotomusiker avatar hirotomusiker commented on September 17, 2024

Perfect!
thank you!

from pytorch_yolov3.

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.