- 21 Dec 2022
- 2 Minutes to read
- Print
- DarkLight
- PDF
Update
- Updated on 21 Dec 2022
- 2 Minutes to read
- Print
- DarkLight
- PDF
Update Metadata
Let's say that you uploaded images and metadata, but you discovered that a Class was misclassified. Suppose that the image name is "image2.png" and its Class should be "5". You can use the LandingLens SDK to make your updates.
Use Case: Update Metadata
from landinglens import LandingLens # Instantiate the llens client # Suppose the image name is 'image2.png', and you need to change its defect type to 5 # Record the updated ones # Iterate the media block by block # Show the number of the updated media |
Update Images and Metadata
After the previous use cases, you've learned how to upload images and retrieve the properties of those images. This section will dive deeper into more complex use cases.
The previous use case discussed how to change the Class of "image2.png" from "2" to "5". On data management, it would be a little confusing. Previously, the defect type could be displayed in file names but this rule doesn't seem to be applied on the updated images.
In this case, to maintain the consistency, you can use LandingLens SDK and the user interface to complete the task:
- Update local images.
- Upload the updated images by llens.media.upload().
- Fill the metadata of the latest upload from step 2 by llens.metadata.upload().
- Tag the data version of the out-of-date media as -1 through llens.metadata.upload().
- Remove the redundant images on LandingLens UI by applying metadata filter.
Folder Structure
. |
Use Cases: Folder Structure
import os # Instantiate the llens client for media in llens.media.ls(no_pagination = True)['medias'][-3:]: # Find out the inconsistent defect type between the media on platform and the local files # 1. Rename the local file # 2. Upload the local renamed image and fetch its media ID on platform # 3. Update the metadata of the latest uploaded one # 4. Tag the data version of the original media as -1 by its ID, meaning out-of-date # 5. Use LandingLens UI to remove media with defect_type = 0. |
New Folder Structure
. |