Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems encountered during training #12

Closed
lrnb12345 opened this issue Aug 22, 2024 · 9 comments
Closed

Problems encountered during training #12

lrnb12345 opened this issue Aug 22, 2024 · 9 comments

Comments

@lrnb12345
Copy link

Hello, after pre training on my own dataset, I conducted a small sample 1way1shot training, but encountered an accuracy of 0 during this process. I would like to ask if this is normal.
Pyhon3 main_f.spy -- config/s3disi_CSeg_fs.yaml savepath/root/autodl-tmp/COSeg-miin/1w1s_train pretrain_mackbone/root/autodl-tmp/COSeg-miin/prtrain cvfold 0 n_way 1 k_shot 1 num_ episode per_comb 1000. This is my instruction.
屏幕截图 2024-08-22 161337

@ZhaochongAn
Copy link
Owner

Hi, it seems not normal. Does the loss decrease during episodic training? What is the pre-training performance? If you are using new dataset, it is also necessary to make sure the input points and labels are correct.

@lrnb12345
Copy link
Author

lrnb12345 commented Aug 22, 2024

你好,这似乎不正常。在情景训练期间损失会减少吗?预训练性能如何?如果您使用的是新数据集,还需要确保输入点和标签正确。

In the costg.py file, my datasets were created based on the s3dis datasets, with a total of nine categories excluding the clutter'. I noticed that in s3dis, there were 12 categories excluding the'clutter' and six categories were set in each fold. However, I only have 9 categories and cannot be classified into the same category in each fold. What should I do,
Also, is there a correlation between setting the fold partition in s3dis_fs.py and setting it in coseg.py?
I have doubts about the parameter settings for categorizing these two files. Did this affect my results? It is worth noting that I modified the code to determine if single card GPU training is related to this
屏幕截图 2024-08-22 215654
Uploading 屏幕截图 2024-08-22 215654.png…

屏幕截图 2024-08-22 213901

@ZhaochongAn
Copy link
Owner

"9 categories"

The category fold division should be fine.

"Also, is there a correlation between setting the fold partition in s3dis_fs.py and setting it in coseg.py? "

You should change the base_class_to_pred_label mapping in coseg.py according to your category division defined in the your dataset. From what you posted here, I could see your base_class_to_pred_label is not changed in terms of your category division. That would lead to incorrect behavier of the base prototype learning.

@lrnb12345
Copy link
Author

lrnb12345 commented Aug 24, 2024

"9 categories"

The category fold division should be fine.

"Also, is there a correlation between setting the fold partition in s3dis_fs.py and setting it in coseg.py? "

You should change the base_class_to_pred_label mapping in coseg.py according to your category division defined in the your dataset. From what you posted here, I could see your base_class_to_pred_label is not changed in terms of your category division. That would lead to incorrect behavier of the base prototype learning.

Thank you for your reply. Is it right for me to do so? Because the nine categories cannot be evenly divided into six categories per fold according to the s3dis dataset. If I modify my categories according to the s3dis_f.spy file, it will report an error. I will modify them as shown in the figure. The training process results are as follows when cvfold=0 1 way 1shot with few samples
屏幕截图 2024-08-24 115852
屏幕截图 2024-08-24 120209

@ZhaochongAn
Copy link
Owner

ZhaochongAn commented Aug 26, 2024

It seems that your dataset has 9 categories in total and you are using all the 9 categories as base classes? You should divide the 9 categories to two folds, such as one fold with 4 categories and the other with 5 categories. Please refer to our dataset definition file of S3DIS and ScanNet.

@lrnb12345
Copy link
Author

It seems that your dataset has 9 categories in total and you are using all the 9 categories as base classes? You should divide the 9 categories to two folds, such as one fold with 4 categories and the other with 5 categories. Please refer to our dataset definition file of S3DIS and ScanNet.

Thank you for your patient reply. After pre training the backbone, I followed your guidance to conduct few shot training. During the process, the program progress was as shown in the figure, with an accuracy of 1. I would like to ask if this is normal,
屏幕截图 2024-08-27 112720

@ZhaochongAn
Copy link
Owner

ZhaochongAn commented Aug 28, 2024

I think it is normal. In my experience, it's common to see high accuracy, which indicates that the model's predictions often encompass the ground truth foreground areas, and usually extend beyond them, as reflected by the relatively low IoU metrics. Also note that the accuracy metric is calculated only for the foreground classes.

@lrnb12345
Copy link
Author

lrnb12345 commented Aug 29, 2024

I think it is normal. In my experience, it's common to see high accuracy, which indicates that the model's predictions often encompass the ground truth foreground areas, and usually extend beyond them, as reflected by the relatively low IoU metrics. Also note that the accuracy metric is calculated only for the foreground classes.

Thank you very much for your patient reply. I have successfully trained and tested to achieve the expected results. However, when I visualized the file generated from the source code (query.npy querylb. npy sup. npy suplb. npy pred. npy), only a small part of the scene appeared, instead of visualizing the entire room like the s3dis dataset. Is it because my data scene is too large? If so, how can I modify the code or related parameters to make the final visualization result a complete visualization of each scene, rather than a small part segmented from a scene.
I ran visualizing. py and the result is shown in the following figure, only a small part of my building scene appeared. Even a category within a scene, such as a wall, cannot be fully visualized
屏幕截图 2024-08-29 124346

@ZhaochongAn
Copy link
Owner

Hi, the figure seems a bit strange. Do you follow the instructions to run the visualization (https://github.com/ZhaochongAn/COSeg/tree/main?tab=readme-ov-file#visualization)? During the visualization, we crop the input point cloud if it have too many points and simply choose the quadrant with the most labelled points to avoid OOM issue. If you have enough GPU memory, you could adjust the point threshold to start the crop and the crop function as well.

COSeg/util/s3dis_fs.py

Lines 587 to 595 in 806b294

# do some crops to avoid OOM
if support:
while coord.shape[0] > 300000:
print("Crop point cloud:", coord.shape[0])
coord, feat, label = self.crop_point_cloud(coord, feat, label)
else:
while coord.shape[0] > 700000:
print("Crop point cloud:", coord.shape[0])
coord, feat, label = self.crop_point_cloud(coord, feat, label)

COSeg/util/s3dis_fs.py

Lines 534 to 578 in 806b294

def crop_point_cloud(self, point_cloud, feat, labels):
# Count the number of points with label 1 in each half of x and y directions
half_x = (point_cloud[:, 0].min() + point_cloud[:, 0].max()) / 2
half_y = (point_cloud[:, 1].min() + point_cloud[:, 1].max()) / 2
# Count points with label 1 in each quadrant
q1_count = np.sum(
(point_cloud[:, 0] <= half_x) & (labels == self.target_cls)
)
q2_count = np.sum(
(point_cloud[:, 0] > half_x) & (labels == self.target_cls)
)
q3_count = np.sum(
(point_cloud[:, 1] > half_y) & (labels == self.target_cls)
)
q4_count = np.sum(
(point_cloud[:, 1] <= half_y) & (labels == self.target_cls)
)
# Choose the quadrant with the most points of label 1
max_count = max(q1_count, q2_count, q3_count, q4_count)
if max_count == q1_count:
return (
point_cloud[(point_cloud[:, 0] <= half_x)],
feat[(point_cloud[:, 0] <= half_x)],
labels[(point_cloud[:, 0] <= half_x)],
)
elif max_count == q2_count:
return (
point_cloud[(point_cloud[:, 0] > half_x)],
feat[(point_cloud[:, 0] > half_x)],
labels[(point_cloud[:, 0] > half_x)],
)
elif max_count == q3_count:
return (
point_cloud[(point_cloud[:, 1] > half_y)],
feat[(point_cloud[:, 1] > half_y)],
labels[(point_cloud[:, 1] > half_y)],
)
else:
return (
point_cloud[(point_cloud[:, 1] <= half_y)],
feat[(point_cloud[:, 1] <= half_y)],
labels[(point_cloud[:, 1] <= half_y)],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants