javiribera / locating-objects-without-bboxes

PyTorch code for "Locating objects without bounding boxes" - Loss function and trained models
Other
249 stars 52 forks source link

modifying for multiple classes #15

Open ZoharKapach opened 4 years ago

ZoharKapach commented 4 years ago

Could you provide a list of required modifications in order for this to work for multiple classes?

javiribera commented 4 years ago

Some of the things that need to be done to extend this implementation to multiple classes:

  1. Make the FCN output multiple probability maps at the output layer (one per object type). Denoted as p_x in Figure 3 of the paper. So now we would have up to p^K_x, being K the number of classes/object types we want to have.
  2. Make the lateral network (the fully-connected layer) at the bottom of Figure 3 output multiple estimations (one per type of object), so we would have one object count estimate per object type, as \hat{C}_1, \hat{C}_2, ... \hat{C}_K
  3. Apply the loss function of Equation 9 to each of the p^k_x and \hat{C}_k separately.
  4. Average all the loss functions
  5. Modify the CSV format to be able to indicate which class corresponds to each object location. This can be done for example by adding a new column called "classes" and indicating them for example as [0, 5, 3]. This way the first object would be of class 0, the second one of class 5 and the third one of class 3. In data.py, the method __getitem__ of the class CSVDataset, and the function csv_collator, would need to be adapted accordingly.
  6. train.py and locate.py would also need modification
  7. (optional) If you want to mark each object class with a different color you would have to modify paint.py
nupur0294 commented 4 years ago

Could you specify the codes where the above changes has to be made? For example FCN we need to put n_classes=2.