simonJJJ commited on
Commit
234db1e
1 Parent(s): 0e49012

update draw box

Browse files
Files changed (1) hide show
  1. tokenization_qwen.py +3 -5
tokenization_qwen.py CHANGED
@@ -410,13 +410,11 @@ class QWenTokenizer(PreTrainedTokenizer):
410
  if image is None:
411
  return None
412
  if image.startswith("http://") or image.startswith("https://"):
413
- image = Image.open(requests.get(image, stream=True).raw)
 
414
  else:
415
- # image = Image.open(image)
416
  image = plt.imread(image)
417
- # h, w = image.height, image.width
418
- # image = image.convert("RGB")
419
- h, w = image.shape[0], image.shape[1]
420
  visualizer = Visualizer(image)
421
 
422
  boxes = self._fetch_all_box_with_ref(response)
 
410
  if image is None:
411
  return None
412
  if image.startswith("http://") or image.startswith("https://"):
413
+ image = Image.open(requests.get(image, stream=True).raw).convert("RGB")
414
+ h, w = image.height, image.width
415
  else:
 
416
  image = plt.imread(image)
417
+ h, w = image.shape[0], image.shape[1]
 
 
418
  visualizer = Visualizer(image)
419
 
420
  boxes = self._fetch_all_box_with_ref(response)