Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	update
Browse files
    	
        examples/vm_sound_classification/step_1_prepare_data.py
    CHANGED
    
    | @@ -37,6 +37,18 @@ def get_dataset(args): | |
| 37 | 
             
                file_dir = Path(args.file_dir)
         | 
| 38 | 
             
                file_dir.mkdir(exist_ok=True)
         | 
| 39 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 40 | 
             
                # label3_map = {
         | 
| 41 | 
             
                #     "bell": "voicemail",
         | 
| 42 | 
             
                #     "white_noise": "mute",
         | 
| @@ -49,18 +61,18 @@ def get_dataset(args): | |
| 49 | 
             
                #     "voice": "voice_or_noise",
         | 
| 50 | 
             
                #     "voicemail": "voicemail",
         | 
| 51 | 
             
                # }
         | 
| 52 | 
            -
                label8_map = {
         | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
                }
         | 
| 64 |  | 
| 65 | 
             
                result = list()
         | 
| 66 | 
             
                for filename_pattern in filename_patterns:
         | 
| @@ -74,10 +86,10 @@ def get_dataset(args): | |
| 74 | 
             
                        folder = filename.parts[-2]
         | 
| 75 | 
             
                        country = filename.parts[-4]
         | 
| 76 |  | 
| 77 | 
            -
                        if folder not in  | 
| 78 | 
             
                            continue
         | 
| 79 |  | 
| 80 | 
            -
                        labels =  | 
| 81 |  | 
| 82 | 
             
                        random1 = random.random()
         | 
| 83 | 
             
                        random2 = random.random()
         | 
|  | |
| 37 | 
             
                file_dir = Path(args.file_dir)
         | 
| 38 | 
             
                file_dir.mkdir(exist_ok=True)
         | 
| 39 |  | 
| 40 | 
            +
                label2_map = {
         | 
| 41 | 
            +
                    "bell": "non_voice",
         | 
| 42 | 
            +
                    "white_noise": "non_voice",
         | 
| 43 | 
            +
                    "low_white_noise": "non_voice",
         | 
| 44 | 
            +
                    "high_white_noise": "non_voice",
         | 
| 45 | 
            +
                    "music": "non_voice",
         | 
| 46 | 
            +
                    "mute": "non_voice",
         | 
| 47 | 
            +
                    "noise": "non_voice",
         | 
| 48 | 
            +
                    "noise_mute": "non_voice",
         | 
| 49 | 
            +
                    "voice": "voice",
         | 
| 50 | 
            +
                    "voicemail": "voice",
         | 
| 51 | 
            +
                }
         | 
| 52 | 
             
                # label3_map = {
         | 
| 53 | 
             
                #     "bell": "voicemail",
         | 
| 54 | 
             
                #     "white_noise": "mute",
         | 
|  | |
| 61 | 
             
                #     "voice": "voice_or_noise",
         | 
| 62 | 
             
                #     "voicemail": "voicemail",
         | 
| 63 | 
             
                # }
         | 
| 64 | 
            +
                # label8_map = {
         | 
| 65 | 
            +
                #     "bell": "bell",
         | 
| 66 | 
            +
                #     "white_noise": "white_noise",
         | 
| 67 | 
            +
                #     "low_white_noise": "white_noise",
         | 
| 68 | 
            +
                #     "high_white_noise": "white_noise",
         | 
| 69 | 
            +
                #     "music": "music",
         | 
| 70 | 
            +
                #     "mute": "mute",
         | 
| 71 | 
            +
                #     "noise": "noise",
         | 
| 72 | 
            +
                #     "noise_mute": "noise_mute",
         | 
| 73 | 
            +
                #     "voice": "voice",
         | 
| 74 | 
            +
                #     "voicemail": "voicemail",
         | 
| 75 | 
            +
                # }
         | 
| 76 |  | 
| 77 | 
             
                result = list()
         | 
| 78 | 
             
                for filename_pattern in filename_patterns:
         | 
|  | |
| 86 | 
             
                        folder = filename.parts[-2]
         | 
| 87 | 
             
                        country = filename.parts[-4]
         | 
| 88 |  | 
| 89 | 
            +
                        if folder not in label2_map.keys():
         | 
| 90 | 
             
                            continue
         | 
| 91 |  | 
| 92 | 
            +
                        labels = label2_map[folder]
         | 
| 93 |  | 
| 94 | 
             
                        random1 = random.random()
         | 
| 95 | 
             
                        random2 = random.random()
         | 
