bnsreenu / python_for_microscopists

https://www.youtube.com/channel/UC34rW-HtPJulxr5wp2Xa04w?sub_confirmation=1
MIT License
3.91k stars 2.39k forks source link

expanding dimension to solve the dimension incompatibility #86

Open sanjeev4427 opened 5 months ago

sanjeev4427 commented 5 months ago

Solving value error in code block 55:


ValueError Traceback (most recent call last)

in () 23 #inputs = processor(single_patch, return_tensors="pt") 24 #Now try with bounding boxes. Remember to uncomment. ---> 25 inputs = processor(single_patch, input_points=input_points, return_tensors="pt") 26 27 # Move the input tensor to the GPU if it's not already there 5 frames /usr/local/lib/python3.10/dist-packages/transformers/image_utils.py in infer_channel_dimension_format(image, num_channels) 198 first_dim, last_dim = 1, 3 199 else: --> 200 raise ValueError(f"Unsupported number of image dimensions: {image.ndim}") 201 202 if image.shape[first_dim] in num_channels: ValueError: Unsupported number of image dimensions: 2
bigseamountain commented 3 months ago

pip install transformers==4.36.2 可以解决这个问题