cal_map2测试有问题,
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:746: UserWarning: Warning: The bbox is out of bounds, the drawn bbox may not be in the image
warnings.warn(
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:817: UserWarning: Warning: The polygon is out of bounds, the drawn polygon may not be in the image
warnings.warn(
这些警告信息分别表示:
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/torch/functional.py:445
:这个警告来自PyTorch库中的torch.meshgrid
函数。警告提到,在即将发布的一个版本中,需要传递索引参数。这可能是因为函数的使用方式即将发生变化。
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:746
:这个警告来自某个可视化模块,警告说边界框超出了图像范围,绘制的边界框可能不在图像内部。
/home/lsw/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:817
:这个警告也来自可视化模块,警告说多边形超出了图像范围,绘制的多边形可能不在图像内部。综合来看,这些警告信息都在提醒开发者注意一些潜在的问题,需要检查并确保边界框和多边形的绘制在图像范围内。
assert isinstance(
AssertionError: [<InstanceData(META INFORMATION
DATA FIELDS
scores: tensor([0.0261, 0.0152, 0.0108, 0.0104, 0.0084, 0.0075, 0.0074, 0.0055, 0.0053,
0.0048, 0.0043, 0.0038, 0.0037, 0.0033, 0.0030, 0.0028, 0.0027, 0.0025,
0.0025, 0.0023, 0.0023, 0.0022, 0.0022, 0.0021, 0.0020, 0.0020, 0.0019,
0.0018, 0.0018, 0.0018, 0.0017, 0.0017, 0.0016, 0.0016, 0.0016, 0.0015,
0.0015, 0.0015, 0.0015, 0.0014, 0.0013, 0.0013, 0.0013, 0.0013, 0.0013,
0.0013, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012,
0.0012, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011,
0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0010, 0.0010, 0.0010, 0.0010,
0.0010], device='cuda:0')
labels: tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0], device='cuda:0')
bboxes: tensor([[ 860.4182, 735.1211, 2008.8546, 2398.9836],
[ 948.0574, 554.4118, 2138.4678, 2163.6702],
[ 673.5732, 481.8880, 2987.2012, 2608.0610],
[ 160.7847, 0.0000, 785.9396, 746.4406],
[ 367.0356, 538.8140, 2510.5144, 2841.9690],
[ 184.9449, 0.0000, 660.0024, 1099.2946],
[1129.0818, 750.7233, 2373.6350, 2396.7944],
[ 929.6042, 916.7177, 2146.8772, 2622.7039],
[ 641.0505, 845.5584, 1837.8342, 2506.6777],
[ 531.3945, 210.4954, 2727.3547, 2407.8716],
[ 341.2751, 2871.1487, 923.6664, 3770.4719],
[ 254.5031, 0.0000, 794.9586, 862.4266],
[ 324.9774, 2477.4114, 909.1008, 3404.3640],
[ 281.2562, 0.0000, 1017.7972, 672.9280],
[1133.3457, 2220.9880, 1748.2812, 3181.5635],
[ 450.7593, 0.0000, 1146.8933, 675.5781],
[1001.0112, 942.8212, 1665.5065, 2039.6573],
[ 297.4333, 0.0000, 2464.5950, 2396.4778],
[ 792.8041, 603.6387, 3024.0000, 3177.3010],
[ 389.6334, 0.0000, 1088.6392, 590.0672],
[1725.8481, 914.9186, 2342.6167, 1947.3942],
[ 66.4204, 257.1548, 2355.2686, 2675.4951],
[1034.9899, 839.6272, 1736.0629, 1905.9021],
[ 73.5181, 107.5601, 766.3165, 1028.0610],
[ 272.4947, 718.5416, 2571.5676, 3411.3582],
[1171.2167, 891.6169, 1899.0852, 1890.4353],
[ 90.5385, 0.0000, 647.0466, 658.5222],
[ 152.9942, 0.0000, 817.7642, 669.7449],
[ 293.9150, 0.0000, 963.7963, 561.8703],
[ 191.4234, 0.0000, 660.2274, 788.7141],
[1025.9906, 2264.9368, 1620.2178, 3305.6091],
[1497.4518, 904.1804, 2158.1145, 1969.1592],
[ 818.3933, 0.0000, 3024.0000, 2441.4946],
[ 45.6488, 0.0000, 688.3436, 926.4277],
[ 376.4414, 2337.5757, 979.9068, 3281.1616],
[1218.9232, 569.5279, 2541.6938, 2164.7051],
[1616.3486, 848.5476, 2259.8374, 1915.5908],
[1123.1927, 1020.3381, 2376.4985, 2712.1367],
[ 0.0000, 510.6859, 2261.5139, 3118.8599],
[ 511.6854, 0.0000, 1150.5703, 574.0575],
[1414.8197, 800.7741, 2074.4648, 1789.1096],
[ 0.0000, 2791.8098, 1051.3660, 4031.0000],
[1010.5120, 160.2552, 3024.0000, 2692.4634],
[1861.5569, 825.2668, 2532.9866, 1754.2875],
[1345.3479, 801.8405, 2616.7466, 2361.6001],
[1115.8459, 790.7441, 1866.2003, 1707.3302],
[ 0.0000, 2942.3936, 556.9386, 4031.0000],
[ 976.2944, 2164.7292, 1661.2295, 3151.2312],
[ 353.8481, 2618.8010, 893.7810, 3710.8086],
[2441.9836, 3315.0042, 3024.0000, 4031.0000],
[ 0.0000, 3145.3379, 505.1198, 4031.0000],
[2192.2048, 3308.2986, 2790.5503, 4031.0000],
[ 730.8935, 453.6034, 1993.9550, 2076.9080],
[ 956.4297, 821.8862, 1722.0027, 1679.3202],
[2664.2283, 3184.9563, 3024.0000, 4031.0000],
[2035.8809, 3337.7483, 2640.9182, 4031.0000],
[ 38.9862, 3043.7522, 602.6025, 4031.0000],
[ 732.1475, 1001.4832, 1928.9716, 2730.0627],
[ 34.1984, 2774.5205, 600.5875, 3961.3647],
[2711.8914, 1865.7842, 3024.0000, 2815.9644],
[ 0.0000, 2772.3359, 499.3558, 3942.9414],
[2538.9058, 3407.4382, 3024.0000, 4031.0000],
[ 114.1778, 0.0000, 609.9687, 923.1790],
[2288.6812, 3350.5955, 2892.3694, 4031.0000],
[2639.0117, 1768.3751, 3024.0000, 3418.1272],
[2550.9160, 3217.3301, 3024.0000, 4031.0000],
[2652.5168, 2075.5933, 3024.0000, 3216.0493],
[ 959.6478, 1146.4388, 1591.4125, 2309.9856],
[ 238.0175, 0.0000, 967.7668, 810.2507],
[1285.0552, 808.8414, 1985.7992, 1859.3011],
[ 0.0000, 2585.1404, 927.8036, 4031.0000],
[2032.5723, 2757.1858, 3024.0000, 4031.0000],
[ 0.0000, 2927.2551, 467.4081, 4031.0000]], device='cuda:0')
) at 0x7f5276e629a0>] should be a <class 'mmengine.structures.instance_data.InstanceData'> but got <class 'list'>
这个错误提示说明期望一个对象是`mmengine.structures.instance_data.InstanceData`类的实例,但实际得到的是一个`list`。
要解决这个问题,需要确保变量是`mmengine.structures.instance_data.InstanceData`类的实例。如果这个变量是从一个列表中获取的,那可能需要检查获取这个变量的代码,并确保它返回的是一个`InstanceData`实例,而不是一个列表。
META INFORMATION DATA FIELDS labels: tensor([], device='cuda:0', dtype=torch.int64) bboxes: tensor([], device='cuda:0', size=(0, 4)) ) at 0x7f01d56852e0> pred_instances: <InstanceData( META INFORMATION DATA FIELDS labels: tensor([0, 2], device='cuda:0') bboxes: tensor([[ 16.2486, 159.7395, 839.4243, 1439.8613], [ 6.1705, 165.3048, 827.2028, 1439.9683]], device='cuda:0') scores: tensor([0.3658, 0.0037], device='cuda:0') ) at 0x7f01d56854c0> ) at 0x7f01d5685d00>]
看起来你贴出了一段包含模型预测结果的数据信息。根据你提供的内容,我可以看到这是一个对象内部的数据字段,包括标签、边界框和得分等信息。这似乎是某种目标检测任务的结果。
如果你需要对这些数据进行处理或者提取相关信息,可以尝试使用以下步骤:
获取标签、边界框和得分:
- 从
pred_instances
中获取标签、边界框和得分的信息。例如,你可以使用以下代码将它们提取出来:python
labels = pred_instances.labels.cpu().numpy() # 获取标签并转换成numpy数组 bboxes = pred_instances.bboxes.cpu().numpy() # 获取边界框并转换成numpy数组 scores = pred_instances.scores.cpu().numpy() # 获取得分并转换成numpy数组
处理数据:
- 一旦你获得了这些数据,你可以根据具体需求进行进一步处理。例如,你可以针对每个预测结果绘制边界框,或者根据得分筛选出高置信度的预测结果。
可视化:
- 如果你需要将结果可视化,你可以使用图形库(如Matplotlib)来绘制图像,并在上面标记预测的边界框。
总的来说,根据你的具体应用场景和需求,你可能需要对这些数据进行不同的处理和分析。希