Predicting multiple instances of multiple classes
In the previous section, we learned about segmenting the Person
class. In this section, we will learn about segmenting for person and table instances in one go by using the same model we built in the previous section. Let’s get started:
Given that the majority of the code remains the same as it was in the previous section, we will only explain the additional code within this section. While executing code, we encourage you to go through the predicting_multiple_instances_of_multiple_classes.ipynb
notebook, which can be found in the Chapter09
folder on GitHub at https://bit.ly/mcvp-2e.
- Fetch images that contain the classes of interest –
Person
(class ID 4) andTable
(class ID 6):classes_list = [4,6] annots = [] for ann in Tqdm(all_annots): _ann = read(ann, 1).transpose(2,0,1) r,g,b = _ann if np.array([num in np.unique(r) for num in \ classes_list]).sum()==0...