Coder Social home page Coder Social logo

RuntimeError: The shape of the mask [1, 1, 128, 128] at index 1 does not match the shape of the indexed tensor [1, 80, 128, 128] at index 1 about centernet HOT 7 CLOSED

duankaiwen avatar duankaiwen commented on September 13, 2024
RuntimeError: The shape of the mask [1, 1, 128, 128] at index 1 does not match the shape of the indexed tensor [1, 80, 128, 128] at index 1

from centernet.

Comments (7)

deprecatedwarrior avatar deprecatedwarrior commented on September 13, 2024 1

In models/CenterNet-104.py, model class definition, the out_dim is hard-coded to 80. For custom datasets with a different out_dim, these need to be changed along with the above-mentioned changes. Just making a note for other users.

from centernet.

li10141110 avatar li10141110 commented on September 13, 2024

I replaced the content of my .data/coco/annotations/instances_{minival2014,trainval2014}.json to my coco style file and replaced the content of my .data/coco/images/{minival2014,trainval2014} to my own images.
following is my CenterNet-104.json file.
{
"system": {
"dataset": "MSCOCO",
"batch_size": 1,
"sampling_function": "kp_detection",

    "train_split": "trainval",
    "val_split": "minival",

    "learning_rate": 0.00025,
    "decay_rate": 10,

    "val_iter": 200,

    "opt_algo": "adam",
    "prefetch_size": 6,

    "max_iter": 100000,
    "stepsize": 4500,
    "snapshot": 5000,

    "chunk_sizes": [1],

    "data_dir": "../data"
},

"db": {
    "rand_scale_min": 0.6,
    "rand_scale_max": 1.4,
    "rand_scale_step": 0.1,
    "rand_scales": null,

    "rand_crop": true,
    "rand_color": true,

    "border": 128,
    "gaussian_bump": true,

    "input_size": [511, 511],
    "output_sizes": [[128, 128]],

    "test_scales": [1],

    "top_k": 70,
    "categories": 1,
    "kp_categories": 1,
    "ae_threshold": 0.5,
    "nms_threshold": 0.5,

    "max_per_image": 100
}

}

from centernet.

Duankaiwen avatar Duankaiwen commented on September 13, 2024

@li10141110 How many categories do you have?

from centernet.

Duankaiwen avatar Duankaiwen commented on September 13, 2024

@li10141110 Add these codes above the
dist = tag_mean.unsqueeze(1) - tag_mean.unsqueeze(2)
in models/py_utils/kp_utils.py:

if len(tag_mean.size()) < 2:

      tag_mean = tag_mean.unsqueeze(0)`  

from centernet.

li10141110 avatar li10141110 commented on September 13, 2024

1 category

from centernet.

li10141110 avatar li10141110 commented on September 13, 2024

Thank you Kaiwen, I make it

from centernet.

nassarofficial avatar nassarofficial commented on September 13, 2024

Did it work with you? I had the same problem but the solution was to edit the categories number in the config file. I am also training with 1 class but I am having problems in the evaluation.

I have only 1 class, and it's giving me a "key error 0"

        category       = self._coco_to_class_map[cat_id]

in the db/coco.py file

from centernet.

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.