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

Can I run it without GUI? #6

Open
weathon opened this issue Sep 11, 2024 · 1 comment
Open

Can I run it without GUI? #6

weathon opened this issue Sep 11, 2024 · 1 comment

Comments

@weathon
Copy link

weathon commented Sep 11, 2024

I got this error because I do not have a GUI interface on my machine.

[09/11 02:31:21 detectron2]: Arguments: Namespace(config_file='configs/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.yaml', cpu=False, parallel=False, visual=False, pred_all_class=False, video_input='../output.mp4', noiof=False, input_dir=None, output_dir='..', vocabulary='lvis', custom_vocabulary='', white_list='bus_(vehicle),truck,train_(railroad_vehicle),wheel,headlight,ladder,crossbar,windshield_wiper,flowerpot,license_plate,streetlight,street_sign,grill,lamppost,trash_can,pole', confidence_threshold=0.4, delta_conf=0.2, fore_threshold=1.0, move_threshold=0.0, opts=['MODEL.WEIGHTS', 'models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth'], max_age=20, min_hits=5, iou_threshold=0.4, pixel=False, num_sam=30, min_match=2, radiu=10, rand_sum=16, fake_thres=50)
/usr/local/lib/python3.10/dist-packages/torch/functional.py:513: 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:3609.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
[09/11 02:31:28 d2.checkpoint.detection_checkpoint]: [DetectionCheckpointer] Loading from models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth ...
[09/11 02:31:28 fvcore.common.checkpoint]: [Checkpointer] Loading from models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth ...
/usr/local/lib/python3.10/dist-packages/fvcore/common/checkpoint.py:252: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  return torch.load(f, map_location=torch.device("cpu"))
Resetting zs_weight datasets/metadata/lvis_v1_clip_a+cname.npy
Click the left mouse button: Select ROI vertices
Click the right mouse button: End ROI selection
Press ESC to exit, if you want global detection, press ESC directly
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.10/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

script/demo.sh: line 78:  9882 Aborted                 (core dumped) CUDA_VISIBLE_DEVICES=${gpu_id} python main.py --output-dir $3 --confidence-threshold ${confidence} --video-input $2 --fore_threshold ${fore_threshold} --move_threshold ${move_threshold} --config-file configs/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.yaml --vocabulary lvis --white_list 'bus_(vehicle),truck,train_(railroad_vehicle),wheel,headlight,ladder,crossbar,windshield_wiper,flowerpot,license_plate,streetlight,street_sign,grill,lamppost,trash_can,pole' --opts MODEL.WEIGHTS models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth
@weathon
Copy link
Author

weathon commented Sep 11, 2024

Solution found, in video_iou.py, comments the following lines.

    cv2.namedWindow('origin')  # create a window
    cv2.setMouseCallback('origin', mouseHandler)  # set mouse callback function
    while True:
        imgCopy = img.copy()
        if len(pts) > 0:
            cv2.circle(imgCopy, pts[-1], 5, (0, 0, 255), -1)  # draw the last point
            if len(pts) > 1:
                for i in range(len(pts) - 1):
                    cv2.circle(imgCopy, pts[i], 5, (0, 0, 255), -1)  # draw the other points
                    cv2.line(imgCopy, pts[i], pts[i + 1], (255, 0, 0), 2)  # draw the line between two points
            if drawing == False:
                cv2.line(imgCopy, pts[0], pts[-1], (255, 0, 0), 2)  # draw the line between the first point and the last point
        cv2.imshow('origin', imgCopy)
        key = 0xFF & cv2.waitKey(1)  # Press ESC to exit
        if key == 27:
            break
    cv2.destroyAllWindows()  # close all windows

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

1 participant