I have changed model.cuda to model.cpu but I am getting a error in line 20 of detect_image(img) function, i.e input_img = Variable(image_tensor.type(Tensor)) saying that
whenever I am trying object detection.py I am getting this error-
Traceback (most recent call last):
File "object_tracker.py", line 87, in
tracked_objects = mot_tracker.update(detections.cpu())
File "Z:\DEEP_Learning\original files\Yolo based model\using GPU\pytorch_objectdetecttrack\sort.py", line 208, in update
matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks)
File "Z:\DEEP_Learning\original files\Yolo based model\using GPU\pytorch_objectdetecttrack\sort.py", line 147, in associate_detections_to_trackers
iou_matrix[d,t] = iou(det,trk)
RuntimeError: Expected object of type torch.FloatTensor but found type torch.DoubleTensor for argument #3 'other'
Hello, I got this error, when I tried to run the program with the custom datasets, anybody know how to resolve it?
('Video size', 640, 480)
(Stream:14631): GStreamer-CRITICAL **: 09:39:54.096: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend does not support this file type.) in CvVideoWriter_GStreamer::open, file /home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp, line 1534
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:
/home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp:1534: error: (-210) Gstreamer Opencv backend does not support this file type. in function CvVideoWriter_GStreamer::open
Traceback (most recent call last):
File "own_object_detection.py", line 276, in
detections = detect_image(pilimg)
File "own_object_detection.py", line 242, in detect_image
image_tensor = img_transforms(img).float()
File "build/bdist.linux-aarch64/egg/torchvision/transforms/transforms.py", line 61, in call
File "build/bdist.linux-aarch64/egg/torchvision/transforms/transforms.py", line 196, in call
File "build/bdist.linux-aarch64/egg/torchvision/transforms/functional.py", line 246, in resize
File "build/bdist.linux-aarch64/egg/PIL/Image.py", line 1892, in resize
TypeError: integer argument expected, got float
Hello, would someone kindly help me with this error
DeprecationWarning: The linear_assignment_ module is deprecated in 0.21 and will be removed from 0.23. Use scipy.optimize.linear_sum_assignment instead.
DeprecationWarning)
Video size 1280 720
2
Traceback (most recent call last):
File "object_tracker.py", line 105, in
cls = classes[int(cls_pred)]
IndexError: list index out of range
Thank you for the notebook and the blog!!
When i try to run the notebook attached for detection and tracking the bounding box dimensions seem to be correct, but their locations are not on the objects. Please let me know what modification need s to be made in the notebook
Hye, what a great project! I tried to run the code however I am using a vgg16 model. I can't run the code since it said the dimension has too many indices on line 136 in utils file. May I know the dimension representing what? And do you have any suggestions or references to give?
I have noticed that when tracking people, if one person walks in front of another there are a couple of frames where the person behind is not detected, and then detected again when the person in front has moved away. However, when this happens the ID of the person has changed. Is there any way to resolve this issue? I suppose not in this instance as there would be no reliable way to tell if this is a new person or not.
I have also noticed it occur on consecutive frames on the same person where one frame has not made a correct detection. In this case would it just be best to lower the detection threshold?
Hi! I am trying to use your code for object detection and tracking using Ubuntu 20.04. Detection on image works fine but when attempting on videos and trying to track, I get following warnings and errors:
/home/anam/anaconda3/envs/yolov3/lib/python3.6/site-packages/torch/nn/_reduction.py:44: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
/home/anam/Codes/YOLOv4/Yolov3/pytorch_objectdetecttrack/sort.py:33: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "iou" failed type inference due to: non-precise type pyobject
During: typing of argument at /home/anam/Codes/YOLOv4/Yolov3/pytorch_objectdetecttrack/sort.py (38)
@jit
/home/anam/anaconda3/envs/yolov3/lib/python3.6/site-packages/numba/core/object_mode_passes.py:178: NumbaWarning: Function "iou" was compiled in object mode without forceobj=True.
File "sort.py", line 34: @jit
def iou(bb_test,bb_gt):
^
state.func_ir.loc))
/home/anam/anaconda3/envs/yolov3/lib/python3.6/site-packages/numba/core/object_mode_passes.py:188: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
File "sort.py", line 34: @jit
def iou(bb_test,bb_gt):
^
state.func_ir.loc))
Traceback (most recent call last):
File "object_detector.py", line 124, in
tracked_objects = mot_tracker.update(detections.cpu())
File "/home/anam/Codes/YOLOv4/Yolov3/pytorch_objectdetecttrack/sort.py", line 209, in update
matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks)
File "/home/anam/Codes/YOLOv4/Yolov3/pytorch_objectdetecttrack/sort.py", line 153, in associate_detections_to_trackers
if(d not in matched_indices[:,0]):
TypeError: tuple indices must be integers or slices, not tuple
When running object_tracker.py, I get the following the error:
/home/ubuntu/.local/lib/python3.6/site-packages/torch/nn/_reduction.py:46: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
: cannot connect to X server
I'd really appreciate if anyone can tell me where is that server or how can I solve this problem?
It would be helpful to include the label document so I can make sense of the code that goes inside the above area.. Not sure how to return the Labels.. seems I need to return a matrix of all classes? Based on a list of pre-filled classes? I want to train new classes with transfer learning and a dataset of images and bounding boxes..
currently my labels are a single text file for each image.. so I will open it and load the text file
MyExampleClass [859, 36, 2329, 1801]
And I seem to need to return a torch.from_numpy likeso
if labels is not None:
filled_labels[range(len(labels))[:self.max_objects]] = labels[:self.max_objects]
filled_labels = torch.from_numpy(filled_labels)
is the filled_labels an array of [[x1,y1,x2,y2,classification]....] ?
While drawing the bounding boxes in the image using plt.savefig(), I am getting the error of ValueError: Image size of 3396073x2015469 pixels is too large. It must be less than 2^16 in each direction.
Can anyone please tell me how to resolve the issue and save the bounding boxes?
Complete error log:
plt.savefig(img_path.replace(".jpg", "-det.png"), dpi=500, bbox_inches='tight', pad_inches=0.0)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/pyplot.py", line 723, in savefig
res = fig.savefig(*args, **kwargs)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/figure.py", line 2203, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2119, in print_figure
result = print_method(
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 514, in print_png
FigureCanvasAgg.draw(self)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 388, in draw
self.renderer = self.get_renderer(cleared=True)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 404, in get_renderer
self.renderer = RendererAgg(w, h, self.figure.dpi)
File "/home/sipaul/anaconda3/envs/pytorch/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 92, in init
self._renderer = _RendererAgg(int(width), int(height), dpi)
ValueError: Image size of 3396073x2015469 pixels is too large. It must be less than 2^16 in each direction