shuyansy / Detect-and-read-meters

This is the first released system towards complex meters` detection and recognition, which is implemented by computer vision techniques.
MIT License
110 stars 15 forks source link

Is it possible to detect the voltmeter or rectangle types of meters? #5

Open FaisalAhmed-NSL opened 1 year ago

FaisalAhmed-NSL commented 1 year ago

These are the samples from the voltmeter. When I wanted to predict this type of image, I found an error that there was no pointer or that I didn't find any lines.

  for x1, y1, x2, y2 in pointer_lines[0]:
TypeError: 'NoneType' object is not subscriptable

s-l400 R DC-Voltmeter analogue-voltmeter-pce-ep29-500

shuyansy commented 1 year ago

i am afraid my dataset does not contain this type of meter. You can label your data and train the model.

FaisalAhmed-NSL commented 1 year ago

Thank you for your reply. These are different types of meters from the dataset. So, is there any change required for the pointer detection and angle calculation algorithms?

Maybe some image processing steps are required to be modified; please suggest some ideas where I need to modify.

shuyansy commented 1 year ago

Take this image as an example. In my framework, you should label pointer mask, scale mask ("0" and "100"), and text mask("100"). However, I think the start of the pointer is not the center of a circle, which may cause inaccurate readings. You should find a way to spot circle center.

截屏2023-05-30 上午11 53 10

In last figure you show, it is ok.

FaisalAhmed-NSL commented 1 year ago

I've a query on YOLO part.

The YOLO model is trained on separately than the best weight is used for the text detection? If yes, please if you can you update your code base along with YOLO training train.py code file and also the configuration of the YOLO v5. which version of YOLO v5 is choosed.

I separately training YOLO v5 base config. But when i want to replace the best.pt file, then getting errors.

File "/envs/analog_meter/lib/python3.9/site-packages/torch/serialization.py", line 1039, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'DetectionModel' on <module 'models.yolo' from '/analog_meters/Detect-and-read-meters/yolov5/models/yolo.py'>

shuyansy commented 1 year ago

I have uploaded the latest code. Yolov5-master folder can be used to train your meter-detection model. You can change the dataset path in train.py

FaisalAhmed-NSL commented 1 year ago

Thank you very much for your code. I'm really grateful for your updated code.