-
Notifications
You must be signed in to change notification settings - Fork 17
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
write image to the record failed: AttributeError: 'NoneType' object has no attribute 'shape' #55
Comments
In fact, I don't know your operation process, you can write down the operation steps in detail then we can find what's wrong |
I checked the code and it works well. Maybe your img path is error and I add check in def write_image():
'''
img_dir: image folder
'''
image_builder = ImageBuilder()
write_file_name = "example_w.record.00002"
img_dir = "../tests/"
with Record(write_file_name, mode='w') as record:
img_paths = sorted(os.listdir(img_dir))
for img_path in img_paths:
if img_path.endswith(".jpg"):
file_path = img_dir + img_path
print(file_path)
pb_image = image_builder.build(file_path, encoding='rgb8')
record.write('/apollo/sensor/camera/front_6mm/image',
pb_image,
int(time.time() * 1e9))
print("Success write image!") |
Pls use |
So how do I write images back to an existing bag? If using mode='w', the old one will be overwritten. |
so it depends on mode='a', and I will finish it in a few days #56 |
Thanks a lot! |
Hi @daohu527 ,
I have successfully used your recover tool to repair the file (after updating the cyber_record). Then I split the file to delete the original imaes. My idea is by transforming the image extracted and then writing it back to the record file to test Apollo. However, when I try to write image data back to the record file, it gives me error: AttributeError: 'NoneType' object has no attribute 'shape'
![image](https://user-images.githubusercontent.com/42797233/195124066-e30761cd-d2ee-4206-ba6b-bf8064e96dd3.png)
Moreover, I tried to write other images to an empty file, and this error is still encountered, but I have not encountered it before I updated the tool (I am using the same data as before). Is there anything conflict among these updates?
![image](https://user-images.githubusercontent.com/42797233/195124535-bcbc0483-3efb-4d79-bbf0-1b6826b0d768.png)
The text was updated successfully, but these errors were encountered: