-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paths4_p3_test_mi10_bin_picking.py
More file actions
42 lines (38 loc) · 1.84 KB
/
s4_p3_test_mi10_bin_picking.py
File metadata and controls
42 lines (38 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Author: Yulin Wang (yulinwang@seu.edu.cn)
# School of Mechanical Engineering, Southeast University, China
import cv2, os, sys
import numpy as np
from HccePose.bop_loader import bop_dataset
from HccePose.tester import Tester
if __name__ == '__main__':
sys.path.insert(0, os.getcwd())
current_dir = os.path.dirname(sys.argv[0])
dataset_path = os.path.join(current_dir, 'demo-bin-picking')
test_img_path = os.path.join(current_dir, 'test_imgs')
bop_dataset_item = bop_dataset(dataset_path)
obj_id = 1
CUDA_DEVICE = '0'
# show_op = False
show_op = True
Tester_item = Tester(bop_dataset_item, show_op = show_op, CUDA_DEVICE=CUDA_DEVICE)
for name in ['IMG_20251007_165718',
'IMG_20251007_165725',
'IMG_20251007_165800',
'IMG_20251007_170223',
'IMG_20251007_170230',
'IMG_20251007_170240',
'IMG_20251007_170250']:
file_name = os.path.join(test_img_path, '%s.jpg'%name)
image = cv2.cvtColor(cv2.imread(file_name), cv2.COLOR_RGB2BGR)
cam_K = np.array([
[2.83925618e+03, 0.00000000e+00, 2.02288638e+03],
[0.00000000e+00, 2.84037288e+03, 1.53940473e+03],
[0.00000000e+00, 0.00000000e+00, 1.00000000e+00],
])
results_dict = Tester_item.predict(cam_K, image, [obj_id],
conf = 0.85, confidence_threshold = 0.85)
cv2.imwrite(file_name.replace('.jpg','_show_2d.jpg'), results_dict['show_2D_results'])
cv2.imwrite(file_name.replace('.jpg','_show_6d_vis0.jpg'), results_dict['show_6D_vis0'])
cv2.imwrite(file_name.replace('.jpg','_show_6d_vis1.jpg'), results_dict['show_6D_vis1'])
cv2.imwrite(file_name.replace('.jpg','_show_6d_vis2.jpg'), results_dict['show_6D_vis2'])
pass