OSCR

Layer-specific feature preference in a trained AlexNet model revealed by stylized image analysis.

Code ↔ Paper

3 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 3 matches
  1. [1] § Methods › AlexNet of the DCNN model for classifying objects ↔ gcn/main.py, lines 67–112 · score 0.67 · dropout layers, activation function, ReLU, architecture, probability, classes
  2. [2] § Methods › AlexNet of the DCNN model for classifying objects ↔ torch_to_pytorch.py, lines 153–240 · score 0.52 · max pooling, ReLU, PyTorch, dropout, Conv
  3. [3] § Methods › Training the AlexNet model using the ImageNet dataset ↔ imagenet/main.py, lines 199–283 · score 0.51 · cross entropy loss, validate, optimization, batch, ImageNet, trained

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 256 lines · 11 KB · BSD-3-Clause · 1 match

  1. import os
  2. import time
  3. import requests
  4. import tarfile
  5. import numpy as np
  6. import argparse
  7. import torch
  8. from torch import nn
  9. import torch.nn.functional as F
  10. from torch.optim import Adam
  11. class GraphConv(nn.Module):
  12. """
  13. Graph Convolutional Layer described in "Semi-Supervised Classification with Graph Convolutional Networks".
  14. Given an input feature representation for each node in a graph, the Graph Convolutional Layer aims to aggregate
  15. information from the node's neighborhood to update its own representation. This is achieved by applying a graph
  16. convolutional operation that combines the features of a node with the features of its neighboring nodes.
  17. Mathematically, the Graph Convolutional Layer can be described as follows:
  18. H' = f(D^(-1/2) * A * D^(-1/2) * H * W)
  19. where:
  20. H: Input feature matrix with shape (N, F_in), where N is the number of nodes and F_in is the number of
  21. input features per node.
  22. A: Adjacency matrix of the graph with shape (N, N), representing the relationships between nodes.
  23. W: Learnable weight matrix with shape (F_in, F_out), where F_out is the number of output features per node.
  24. D: The degree matrix.
  25. """
  26. def __init__(self, input_dim, output_dim, use_bias=False):
  27. super(GraphConv, self).__init__()
  28. # Initialize the weight matrix W (in this case called `kernel`)
  29. self.kernel = nn.Parameter(torch.Tensor(input_dim, output_dim))
  30. nn.init.xavier_normal_(self.kernel) # Initialize the weights using Xavier initialization
  31. # Initialize the bias (if use_bias is True)
  32. self.bias = None
  33. if use_bias:
  34. self.bias = nn.Parameter(torch.Tensor(output_dim))
  35. nn.init.zeros_(self.bias) # Initialize the bias to zeros
  36. def forward(self, input_tensor, adj_mat):
  37. """
  38. Performs a graph convolution operation.
  39. Args:
  40. input_tensor (torch.Tensor): Input tensor representing node features.
  41. adj_mat (torch.Tensor): Normalized adjacency matrix representing graph structure.
  42. Returns:
  43. torch.Tensor: Output tensor after the graph convolution operation.
  44. """
  45. support = torch.mm(input_tensor, self.kernel) # Matrix multiplication between input and weight matrix
  46. output = torch.spmm(adj_mat, support) # Sparse matrix multiplication between adjacency matrix and support
  47. # Add the bias (if bias is not None)
  48. if self.bias is not None:
  49. output = output + self.bias
  50. return output
  51. class GCN(nn.Module):
  52. """
  53. Graph Convolutional Network (GCN) as described in the paper `"Semi-Supervised Classification with Graph
  54. Convolutional Networks" <https://arxiv.org/pdf/1609.02907.pdf>`.
  55. The Graph Convolutional Network is a deep learning architecture designed for semi-supervised node
  56. classification tasks on graph-structured data. It leverages the graph structure to learn node representations
  57. by propagating information through the graph using graph convolutional layers.
  58. The original implementation consists of two stacked graph convolutional layers. The ReLU activation function is
  59. applied to the hidden representations, and the Softmax activation function is applied to the output representations.
  60. """
  61. def __init__(self, input_dim, hidden_dim, output_dim, use_bias=True, dropout_p=0.1):
  62. super(GCN, self).__init__()
  63. # Define the Graph Convolution layers
  64. self.gc1 = GraphConv(input_dim, hidden_dim, use_bias=use_bias)
  65. self.gc2 = GraphConv(hidden_dim, output_dim, use_bias=use_bias)
  66. # Define the dropout layer
  67. self.dropout = nn.Dropout(dropout_p)
  68. def forward(self, input_tensor, adj_mat):
  69. """
  70. Performs forward pass of the Graph Convolutional Network (GCN).
  71. Args:
  72. input_tensor (torch.Tensor): Input node feature matrix with shape (N, input_dim), where N is the number of nodes
  73. and input_dim is the number of input features per node.
  74. adj_mat (torch.Tensor): Normalized adjacency matrix of the graph with shape (N, N), representing the relationships between
  75. nodes.
  76. Returns:
  77. torch.Tensor: Output tensor with shape (N, output_dim), representing the predicted class probabilities for each node.
  78. """
  79. # Perform the first graph convolutional layer
  80. x = self.gc1(input_tensor, adj_mat)
  81. x = F.relu(x) # Apply ReLU activation function
  82. x = self.dropout(x) # Apply dropout regularization
  83. # Perform the second graph convolutional layer
  84. x = self.gc2(x, adj_mat)
  85. # Apply log-softmax activation function for classification
  86. return F.log_softmax(x, dim=1)
  87. def load_cora(path='./cora', device='cpu'):
  88. """
  89. The graph convolutional operation rquires the normalized adjacency matrix: D^(-1/2) * A * D^(-1/2). This step
  90. scales the adjacency matrix such that the features of neighboring nodes are weighted appropriately during
  91. aggregation. The steps involved in the renormalization trick are as follows:
  92. - Compute the degree matrix.
  93. - Compute the inverse square root of the degree matrix.
  94. - Multiply the inverse square root of the degree matrix with the adjacency matrix.
  95. """
  96. # Set the paths to the data files
  97. content_path = os.path.join(path, 'cora.content')
  98. cites_path = os.path.join(path, 'cora.cites')
  99. # Load data from files
  100. content_tensor = np.genfromtxt(content_path, dtype=np.dtype(str))
  101. cites_tensor = np.genfromtxt(cites_path, dtype=np.int32)
  102. # Process features
  103. features = torch.FloatTensor(content_tensor[:, 1:-1].astype(np.int32)) # Extract feature values
  104. scale_vector = torch.sum(features, dim=1) # Compute sum of features for each node
  105. scale_vector = 1 / scale_vector # Compute reciprocal of the sums
  106. scale_vector[scale_vector == float('inf')] = 0 # Handle division by zero cases
  107. scale_vector = torch.diag(scale_vector).to_sparse() # Convert the scale vector to a sparse diagonal matrix
  108. features = scale_vector @ features # Scale the features using the scale vector
  109. # Process labels
  110. classes, labels = np.unique(content_tensor[:, -1], return_inverse=True) # Extract unique classes and map labels to indices
  111. labels = torch.LongTensor(labels) # Convert labels to a tensor
  112. # Process adjacency matrix
  113. idx = content_tensor[:, 0].astype(np.int32) # Extract node indices
  114. idx_map = {id: pos for pos, id in enumerate(idx)} # Create a dictionary to map indices to positions
  115. # Map node indices to positions in the adjacency matrix
  116. edges = np.array(
  117. list(map(lambda edge: [idx_map[edge[0]], idx_map[edge[1]]],
  118. cites_tensor)), dtype=np.int32)
  119. V = len(idx) # Number of nodes
  120. E = edges.shape[0] # Number of edges
  121. adj_mat = torch.sparse_coo_tensor(edges.T, torch.ones(E), (V, V), dtype=torch.int64) # Create the initial adjacency matrix as a sparse tensor
  122. adj_mat = torch.eye(V) + adj_mat # Add self-loops to the adjacency matrix
  123. degree_mat = torch.sum(adj_mat, dim=1) # Compute the sum of each row in the adjacency matrix (degree matrix)
  124. degree_mat = torch.sqrt(1 / degree_mat) # Compute the reciprocal square root of the degrees
  125. degree_mat[degree_mat == float('inf')] = 0 # Handle division by zero cases
  126. degree_mat = torch.diag(degree_mat).to_sparse() # Convert the degree matrix to a sparse diagonal matrix
  127. adj_mat = degree_mat @ adj_mat @ degree_mat # Apply the renormalization trick
  128. return features.to_sparse().to(device), labels.to(device), adj_mat.to_sparse().to(device)
  129. def train_iter(epoch, model, optimizer, criterion, input, target, mask_train, mask_val, print_every=10):
  130. start_t = time.time()
  131. model.train()
  132. optimizer.zero_grad()
  133. # Forward pass
  134. output = model(*input)
  135. loss = criterion(output[mask_train], target[mask_train]) # Compute the loss using the training mask
  136. loss.backward()
  137. optimizer.step()
  138. # Evaluate the model performance on training and validation sets
  139. loss_train, acc_train = test(model, criterion, input, target, mask_train)
  140. loss_val, acc_val = test(model, criterion, input, target, mask_val)
  141. if epoch % print_every == 0:
  142. # Print the training progress at specified intervals
  143. print(f'Epoch: {epoch:04d} ({(time.time() - start_t):.4f}s) loss_train: {loss_train:.4f} acc_train: {acc_train:.4f} loss_val: {loss_val:.4f} acc_val: {acc_val:.4f}')
  144. def test(model, criterion, input, target, mask):
  145. model.eval()
  146. with torch.no_grad():
  147. output = model(*input)
  148. output, target = output[mask], target[mask]
  149. loss = criterion(output, target)
  150. acc = (output.argmax(dim=1) == target).float().sum() / len(target)
  151. return loss.item(), acc.item()
  152. if __name__ == '__main__':
  153. parser = argparse.ArgumentParser(description='PyTorch Graph Convolutional Network')
  154. parser.add_argument('--epochs', type=int, default=200,
  155. help='number of epochs to train (default: 200)')
  156. parser.add_argument('--lr', type=float, default=0.01,
  157. help='learning rate (default: 0.01)')
  158. parser.add_argument('--l2', type=float, default=5e-4,
  159. help='weight decay (default: 5e-4)')
  160. parser.add_argument('--dropout-p', type=float, default=0.5,
  161. help='dropout probability (default: 0.5)')
  162. parser.add_argument('--hidden-dim', type=int, default=16,
  163. help='dimension of the hidden representation (default: 16)')
  164. parser.add_argument('--val-every', type=int, default=20,
  165. help='epochs to wait for print training and validation evaluation (default: 20)')
  166. parser.add_argument('--include-bias', action='store_true',
  167. help='use bias term in convolutions (default: False)')
  168. parser.add_argument('--no-accel', action='store_true',
  169. help='disables accelerator')
  170. parser.add_argument('--dry-run', action='store_true',
  171. help='quickly check a single pass')
  172. parser.add_argument('--seed', type=int, default=42, metavar='S',
  173. help='random seed (default: 42)')
  174. args = parser.parse_args()
  175. use_accel = not args.no_accel and torch.accelerator.is_available()
  176. torch.manual_seed(args.seed)
  177. if use_accel:
  178. device = torch.accelerator.current_accelerator()
  179. else:
  180. device = torch.device('cpu')
  181. print(f'Using {device} device')
  182. cora_url = 'https://linqs-data.soe.ucsc.edu/public/lbc/cora.tgz'
  183. print('Downloading dataset...')
  184. with requests.get(cora_url, stream=True) as tgz_file:
  185. with tarfile.open(fileobj=tgz_file.raw, mode='r:gz') as tgz_object:
  186. tgz_object.extractall()
  187. print('Loading dataset...')
  188. features, labels, adj_mat = load_cora(device=device)
  189. idx = torch.randperm(len(labels)).to(device)
  190. idx_test, idx_val, idx_train = idx[:1000], idx[1000:1500], idx[1500:]
  191. gcn = GCN(features.shape[1], args.hidden_dim, labels.max().item() + 1, args.include_bias, args.dropout_p).to(device)
  192. optimizer = Adam(gcn.parameters(), lr=args.lr, weight_decay=args.l2)
  193. criterion = nn.NLLLoss()
  194. for epoch in range(args.epochs):
  195. train_iter(epoch + 1, gcn, optimizer, criterion, (features, adj_mat), labels, idx_train, idx_val, args.val_every)
  196. if args.dry_run:
  197. break
  198. loss_test, acc_test = test(gcn, criterion, (features, adj_mat), labels, idx_test)
  199. print(f'Test set results: loss {loss_test:.4f} accuracy {acc_test:.4f}')

main.py at commit acc295d, under BSD-3-Clause · at the source

Overview

Authors: Nobuhiko Wagatsuma1, Kazuma Ito1, Akinori Hidaka2
  1. Department of Information Science, Faculty of Science, Toho University,2-2-1 Miyama, Funabashi, Chiba, 274-8510 Japan
  2. School of Science and Engineering, Tokyo Denki University,Saitama, Japan
Institutions: Toho University (Japan); Tokyo Denki University (Japan)
Journal: Scientific reports, volume 16, issue 1, article 22791
Dates: received 25 February 2026; accepted 11 May 2026; published online 19 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-53152-9 · PMID 42156935 · PMCID PMC13385648 · OpenAlex W7161634099
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: none (in silico) (organism)
Methods: Smoothing, state filtering, decompositions, Connectivity, Machine learning
Keywords: Deep convolutional neural network, AlexNet, Object classification, UMAP, Model neuron preference, Engineering, Mathematics and computing
Topic: Face Recognition and Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Japanese Society for the Promotion of Science (JSPS) (KAKENHI Grants JP23H03697); Toho University Grant for Research Initiative Program (TUGRIP)
Citations: not cited yet (Europe PMC); 53 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repositories

Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.

pytorch/examples

License: BSD-3-Clause
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: acc295dc7b90714f1bf47f06004fc19a7fe235c4, 1 September 2025
Languages: Python (93), Shell (12), C++ (9), C/C++ (1)
Size: 238 files, 115 scripts
Software Heritage: archived
Found in: “Data availability”
Holds: README, license file, environment (runtime.txt, dcgan/requirements.txt, docs/requirements.txt, fast_neural_style/requirements.txt, fx/requirements.txt, gat/requirements.txt, gcn/requirements.txt, imagenet/requirements.txt, language_translation/requirements.txt, mnist/requirements.txt, mnist_forward_forward/requirements.txt, mnist_hogwild/requirements.txt), continuous integration, documentation
Not found: CITATION.cff, tests
Tools: PyTorch (84 files), NumPy (11 files), Hugging Face Transformers (5 files), Pillow (3 files), Matplotlib (2 files), pandas (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
117 files

naoto0804/pytorch-AdaIN

License: MIT
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 47950d0e6656a95a80a4b105c4c0f58d38ef785c, 23 January 2024
Languages: Python (7)
Size: 47 files, 7 scripts
Software Heritage: not archived
Found in: the text, “Generation of stylized images”
Holds: README, license file, environment (requirements.txt)
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: PyTorch (7 files), Pillow (3 files), NumPy (2 files), imageio (1 file), OpenCV (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
9 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 122 scripts, each with its path and the digest of its content;
  • 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • it points to the authors' code: pytorch/examples
  • it says that the data are available on request

Read it in the paper: doi.org/10.1038/s41598-026-53152-9.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 7 keywords, 2 funders, 42 references.

Cite

This paper

Wagatsuma, N., Ito, K., & Hidaka, A. (2026). Layer-specific feature preference in a trained AlexNet model revealed by stylized image analysis. Scientific reports, 16(1), 22791. https://doi.org/10.1038/s41598-026-53152-9

BibTeX

@article{wagatsuma2026layer,
author = {Wagatsuma, Nobuhiko and Ito, Kazuma and Hidaka, Akinori},
title = {{Layer-specific feature preference in a trained AlexNet model revealed by stylized image analysis}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {22791},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-53152-9},
url = {https://doi.org/10.1038/s41598-026-53152-9},
pmid = {42156935},
pmcid = {PMC13385648}
}

RIS

TY - JOUR
AU - Wagatsuma, Nobuhiko
AU - Ito, Kazuma
AU - Hidaka, Akinori
TI - Layer-specific feature preference in a trained AlexNet model revealed by stylized image analysis
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/05/19
VL - 16
IS - 1
SP - 22791
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-53152-9
UR - https://doi.org/10.1038/s41598-026-53152-9
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-53152-9",
"type": "article-journal",
"title": "Layer-specific feature preference in a trained AlexNet model revealed by stylized image analysis",
"container-title": "Scientific reports",
"author": [
{
"family": "Wagatsuma",
"given": "Nobuhiko"
},
{
"family": "Ito",
"given": "Kazuma"
},
{
"family": "Hidaka",
"given": "Akinori"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "22791",
"DOI": "10.1038/s41598-026-53152-9",
"PMID": "42156935",
"PMCID": "PMC13385648",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-53152-9",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
19
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1162/imag.a.1207 [code]
Investigating the temporal dynamics and modeling of mid-level feature representations in humans.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: OpenCV, Pillow, PyTorch, 3 other tools, 4 references
[2] doi:10.1371/journal.pcbi.1014263 [code]
MIRAGE: Robust multi-modal architectures translate fMRI-to-image models from vision to mental imagery.
Journal: PLoS computational biology
In common: imageio, Hugging Face Transformers, OpenCV, 5 other tools, 1 reference
[3] doi:10.1038/s42003-026-10169-0 [code]
Shared representations in brains and models reveal a two-route cortical organization during scene perception.
Journal: Communications biology
In common: Hugging Face Transformers, Pillow, PyTorch, 3 other tools, 3 references
[4] doi:10.1038/s41467-026-76098-y [code]
A single computational objective can produce specialization of streams in visual cortex.
Journal: Nature communications
In common: Hugging Face Transformers, Pillow, PyTorch, 3 other tools, 3 references
[5] doi:10.7554/elife.105953 [code]
Top-down feedback in deep neural networks leads to functional differences during audiovisual integration.
Journal: eLife
In common: Pillow, PyTorch, pandas, 2 other tools, 4 references
[6] doi:10.1371/journal.pcbi.1014752 [code]
Hierarchical feature binding in a spiking neural network model of the primate ventral visual pathway.
Journal: PLoS computational biology
In common: OpenCV, pandas, Matplotlib, 1 other tool, 4 references
[7] doi:10.1162/imag.a.1326 [code]
RAVEN: Robust, generalizable, multi-resolution structural MRI upsampling using autoencoders.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: imageio, Hugging Face Transformers, OpenCV, 5 other tools
[8] doi:10.1038/s41467-026-74358-5 [code]
Brain-inspired spatial intelligence for embodied agents.
Journal: Nature communications
In common: imageio, Hugging Face Transformers, OpenCV, 5 other tools
[9] doi:10.1167/jov.26.8.1 [code]
MAME: Multidimensional adaptive metamer exploration with human perceptual feedback.
Journal: Journal of vision
In common: OpenCV, Pillow, PyTorch, 3 other tools, 3 references
[10] doi:10.3389/fncir.2026.1783892 [code]
Representations of facial features and surface quality in monkey area TE compared to neural network models.
Journal: Frontiers in neural circuits
In common: Pillow, PyTorch, NumPy, 4 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.