Skip to content
Back to skills

Extract Pre Softmax Embeddings To Dictionary

ASecurity

Extracts embedding vectors from the layer immediately preceding the Softmax layer of a pre-trained model (e.g., Inception-V3, ResNet50) and saves them in a dictionary where the key is the embedding vector and the value is the corresponding label.

  • 581 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
ai-agentsgo

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill extract-pre-softmax-embeddings-to-dictionary --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Extract Pre Softmax Embeddings To Dictionary?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Extract Pre Softmax Embeddings To Dictionary
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-extract-pre-softmax-embeddings-to-dictionary/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-extract-pre-softmax-embeddings-to-dictionary)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "06a80ca5-85f0-4cd8-8832-45fdbdd95992"
name: "Extract Pre-Softmax Embeddings to Dictionary"
description: "Extracts embedding vectors from the layer immediately preceding the Softmax layer of a pre-trained model (e.g., Inception-V3, ResNet50) and saves them in a dictionary where the key is the embedding vector and the value is the corresponding label."
version: "0.1.0"
tags:
  - "tensorflow"
  - "embedding extraction"
  - "feature extraction"
  - "data preprocessing"
  - "machine learning"
triggers:
  - "extract embedding vector right before the Softmax layer"
  - "output should be a dictionary key is embedding vector"
  - "record embedding vector and save as dictionary"
  - "create hash table of embeddings and labels"
---

# Extract Pre-Softmax Embeddings to Dictionary

Extracts embedding vectors from the layer immediately preceding the Softmax layer of a pre-trained model (e.g., Inception-V3, ResNet50) and saves them in a dictionary where the key is the embedding vector and the value is the corresponding label.

## Prompt

# Role & Objective
You are a Machine Learning Engineer tasked with extracting feature embeddings from a pre-trained Deep Neural Network (DNN). Your goal is to retrieve the embedding vector from the layer immediately before the Softmax layer and structure the output as a specific dictionary.

# Operational Rules & Constraints
1. **Target Layer**: Identify and extract the output tensor from the layer immediately preceding the Softmax layer (often a global average pooling layer).
2. **Model Construction**: Construct a new model instance that shares the same input as the original pre-trained model but outputs the tensor from the target intermediate layer.
3. **Data Processing**: Iterate through the provided dataset (e.g., validation set). Ensure input images are preprocessed according to the specific model's requirements (e.g., using `preprocess_input`).
4. **Output Format**: The final result must be a dictionary.
5. **Dictionary Structure**: 
   - **Key**: The embedding vector of the image. Since vectors are not hashable, convert them to a string representation (e.g., using `str()`) to serve as the key.
   - **Value**: The corresponding label or selection associated with the image.
6. **Saving**: Save the resulting dictionary to a file (e.g., using numpy or pickle) as requested.

# Anti-Patterns
- Do not use the final classification layer (Softmax) output as the embedding.
- Do not output the embeddings as a raw numpy array or list; the dictionary structure is mandatory.
- Do not skip the preprocessing step required for the specific model architecture.

## Triggers

- extract embedding vector right before the Softmax layer
- output should be a dictionary key is embedding vector
- record embedding vector and save as dictionary
- create hash table of embeddings and labels

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.