google / sg2im

Code for "Image Generation from Scene Graphs", Johnson et al, CVPR 2018
Apache License 2.0
1.29k stars 230 forks source link

I found that in sg2im/sg2im/data/vg.py per image maybe have different numbers of objects? #22

Open alice-cool opened 3 years ago

alice-cool commented 3 years ago

I found that in sg2im/sg2im/data/vg.py per image maybe have different numbers of objects?

jcjohnson commented 3 years ago

Yes, the number of objects can vary from image to image.

alice-cool commented 3 years ago

Thanks for your timely reply.

    if len(obj_idxs) < self.max_objects - 1 and self.use_orphaned_objects:
      num_to_add = self.max_objects - 1 - len(obj_idxs)
      num_to_add = min(num_to_add, len(obj_idxs_without_rels))
      obj_idxs += random.sample(obj_idxs_without_rels, num_to_add)
    O = len(obj_idxs) + 1

And In the last training, different numbers of object don't impact the scene layout generation. I always think the fixed number of per image can be trained in end-to-end. Thanks for your share

jcjohnson commented 3 years ago

Sorry, I don't understand your question?

alice-cool commented 3 years ago

Dear scholar, I want to say I always think the fixed numbers of objects per image (such as 10, if it isn't up to 10,then pad more empty object to meet the fixed number) can be trained in end-to-end. When seeing your code, I found it doesn't need fixed numbers as longas it is lower than 10(max_number_object), It also can form the scene layout and be trained end-to-end.