Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	debug: removed labels
Browse files
    	
        yolov8.py
    CHANGED
    
    | @@ -160,10 +160,10 @@ def dff_nmf(image, target_lyr, n_components): | |
| 160 | 
             
                concepts, batch_explanations, explanations = dff(input_tensor, model, n_components)
         | 
| 161 |  | 
| 162 |  | 
| 163 | 
            -
                yolov5_categories_url = \
         | 
| 164 | 
             
                        "https://github.com/ultralytics/yolov5/raw/master/data/coco128.yaml"  # URL to the YOLOv5 categories file
         | 
| 165 | 
            -
                yaml_data = requests.get(yolov5_categories_url).text
         | 
| 166 | 
            -
             | 
| 167 | 
             
                num_classes = model.model.model[-1].nc 
         | 
| 168 | 
             
                results = []
         | 
| 169 | 
             
                for indx in range(explanations[0].shape[0]):
         | 
| @@ -200,8 +200,8 @@ def dff_nmf(image, target_lyr, n_components): | |
| 200 | 
             
                            linewidth=2, edgecolor='r', facecolor='none')
         | 
| 201 | 
             
                    ax.add_patch(rect)
         | 
| 202 |  | 
| 203 | 
            -
                    predicted_label = labels[top_class_id]  # Map ID to label
         | 
| 204 | 
            -
                    ax.text(x1, y1, f"{predicted_label}: {top_score:.2f}",
         | 
| 205 | 
             
                        color='r', fontsize=12, verticalalignment='top')
         | 
| 206 | 
             
                    plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
         | 
| 207 |  | 
|  | |
| 160 | 
             
                concepts, batch_explanations, explanations = dff(input_tensor, model, n_components)
         | 
| 161 |  | 
| 162 |  | 
| 163 | 
            +
                #yolov5_categories_url = \
         | 
| 164 | 
             
                        "https://github.com/ultralytics/yolov5/raw/master/data/coco128.yaml"  # URL to the YOLOv5 categories file
         | 
| 165 | 
            +
                #yaml_data = requests.get(yolov5_categories_url).text
         | 
| 166 | 
            +
               # labels = yaml.safe_load(yaml_data)['names']  # Parse the YAML file to get class names
         | 
| 167 | 
             
                num_classes = model.model.model[-1].nc 
         | 
| 168 | 
             
                results = []
         | 
| 169 | 
             
                for indx in range(explanations[0].shape[0]):
         | 
|  | |
| 200 | 
             
                            linewidth=2, edgecolor='r', facecolor='none')
         | 
| 201 | 
             
                    ax.add_patch(rect)
         | 
| 202 |  | 
| 203 | 
            +
                    #predicted_label = labels[top_class_id]  # Map ID to label
         | 
| 204 | 
            +
                    #ax.text(x1, y1, f"{predicted_label}: {top_score:.2f}",
         | 
| 205 | 
             
                        color='r', fontsize=12, verticalalignment='top')
         | 
| 206 | 
             
                    plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
         | 
| 207 |  |